#!/bin/sh CLEANUPSCRIPT="/usr/local/torque/current/miami-custom/torquejobcleanup" ### argv[1] => jobid ### argv[2] => username ### argv[3] => groupname ### argv[4] => jobname ### argv[5] => session id ### argv[6] => requested resource limit ### argv[7] => list of resources used ### argv[8] => name of the queue ### argv[9] => account string NODEFILE="/usr/local/torque/current/var/spool/torque/aux/$1" jobID=$1 userName=$2 hostlist="" ### build the host list if [ -r "$NODEFILE" ]; then for aNode in `cat $NODEFILE | sort | uniq`; do if [ "x$hostlist" = "x" ]; then hostlist="$aNode" else t=$hostlist hostlist="$t,$aNode" fi done fi touch /tmp/epilogue.start.$jobID ### su - $userName -c "pdsh -w $hostlist $CLEANUPSCRIPT $jobID $userName" >> /tmp/epilogue.su.clean.$jobID 2>&1 ### it's hard to make su - user work properly, since you'll need to exclude the process that is doing the cleaning pdsh -w $hostlist $CLEANUPSCRIPT $jobID $userName >> /tmp/epilogue.su.clean.$jobID 2>&1 touch /tmp/epilogue.end.$jobID