31 lines
760 B
Bash
Executable File
31 lines
760 B
Bash
Executable File
#!/usr/bin/ksh
|
|
|
|
# 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 $(hostname): $USER $1 $2 $3 $4" >> ~$3/qdel_log.log
|
|
#echo $(pgrep -g $1) >> ~$3/qdel_log.log
|
|
|
|
for sig in INT TERM KILL
|
|
do
|
|
stat=$(pgrep -g $1 -u $3)
|
|
if [ ! -z "${stat}" ]
|
|
then
|
|
#echo "Sending SIG${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
|