gridengine/bin/term.sh

31 lines
778 B
Bash
Executable File

#!/usr/bin/ksh
# $Id: term.sh 364 2013-11-18 09:55:05Z kasper $
# This script should be added as the TERMINATE_METHOD in the
# queue definition with $job_pid, $job_id, $job_owner, and interval arguments.
# e.g. script.sh $job_pid $job_id $job_owner 90
if [ -z "$4" ]
then
echo "Usage: $0 \$job_pid \$job_id \$job_owner interval"
exit 1
fi
#echo "Term script Running on: $USER $1 $2 $3 $4" >> ~$3/qdel_log.log
#echo `pgrep -g $1` >> ~$3/qdel_log.log
for sig in 2 15 9
do
stat=`pgrep -g $1 -u $3`
if [ ! -z "$stat" ]
then
#echo "Sending $sig to $1" >> ~$3/qdel_log.log
/usr/bin/pkill --signal $sig -g $1
sleep $4
else
break
fi
done
#uncomment the following for debugging
#echo "Job $2 killed." >> ~$3/qdel_log.log