Commit a78c5742 authored by Paul Rich's avatar Paul Rich
Browse files

Adding in an enhanced apkill script to provide stronger cleanup

Including this until a later upgrade can be done that has Cobalt
directly send a SIGKILL 5 minutes after we try to signal an aprun at
cleanup.
parent 079d16a5
#!/bin/bash
# For those times when politely asking an applicaiton to terminate isn't
# sufficient. This first sends the passed signal through to apkill, then waits
# 5 minutes for termination. Then sends another apkill -SIGKILL. This is as big
# a hammer as we have for termination.
apkill_cmd='/opt/cray/alps/default/bin/apkill'
apstat_cmd='/opt/cray/alps/default/bin/apstat'
if [[ "$#" -lt "2" ]]
then
echo "Usage: enhanced_apkill -[signal] [pidlist]"
exit 1
fi
$apkill_cmd $1 ${@:2}
sleep 300
for apid in ${@:2}
do
found_apid=`awk "/$apid/ {print \\$0}" <((apstat -a $apid 2> /dev/null))`
if [ -n "$found_apid" ]
then
echo Sending SIGKILL to $apid
$apkill_cmd -9 $apid
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment