2021-05-25 11:25:11 +02:00
|
|
|
#!/usr/bin/ksh
|
2024-08-26 17:52:43 +02:00
|
|
|
|
2021-05-25 11:25:11 +02:00
|
|
|
# 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
|
|
|
|
|
2024-08-26 17:52:43 +02:00
|
|
|
#echo "Term script Running on $(hostname): $USER $1 $2 $3 $4" >> ~$3/qdel_log.log
|
|
|
|
#echo $(pgrep -g $1) >> ~$3/qdel_log.log
|
2021-05-25 11:25:11 +02:00
|
|
|
|
2024-08-26 17:52:43 +02:00
|
|
|
for sig in INT TERM KILL
|
2021-05-25 11:25:11 +02:00
|
|
|
do
|
2024-08-26 17:52:43 +02:00
|
|
|
stat=$(pgrep -g $1 -u $3)
|
|
|
|
if [ ! -z "${stat}" ]
|
2021-05-25 11:25:11 +02:00
|
|
|
then
|
2024-08-26 17:52:43 +02:00
|
|
|
#echo "Sending SIG${sig} to $1" >> ~$3/qdel_log.log
|
|
|
|
/usr/bin/pkill --signal ${sig} -g $1
|
2021-05-25 11:25:11 +02:00
|
|
|
sleep $4
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
#uncomment the following for debugging
|
|
|
|
#echo "Job $2 killed." >> ~$3/qdel_log.log
|