#!/bin/csh # # General epilogue script for PBS # This file is run only on the first node, so we must setup all # nodes in the parallel job. We will assume rhosts is setup for now. # # This script deletes the scratch directory for the job on each node # and kills all remaining processes owned by the user. # # just delete the directory locally since it is the first node if (-e /scratch/$1) then rm -r /scratch/$1 endif set KILLCOMMAND="kill -9 -1" if (-e /usr/spool/PBS/aux/$1) then set HOSTLIST set nmax=`wc -l /usr/spool/PBS/aux/$1` set nmax=$nmax[1] @ NODE=1 while ($NODE <= $nmax) set NODENAME=`sed -n -e "$NODE p" /usr/spool/PBS/aux/$1` set -f HOSTLIST=($HOSTLIST $NODENAME) @ NODE++ end @ NODE=2 while ($NODE <= $#HOSTLIST) if ($HOSTLIST[$NODE] != m0) then /usr/bin/ssh $HOSTLIST[$NODE] "rm -f -r /scratch/$1;su $2 -c '$KILLCOMMAND'" else /usr/bin/ssh $HOSTLIST[$NODE] "rm -f -r /scratch/$1" endif @ NODE++ end endif # cleanup local user processes su $2 -c "$KILLCOMMAND" # # Before quiting ping maui to let it know we're done # #/usr/local/bin/schedctl -r 4 >& /dev/null # exit(0)