/usr/share/arc/cancel-fork-job is in nordugrid-arc-arex 4.0.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #!/bin/sh
# set -x
#
# Cancel job running in FORK.
#
echo "----- starting cancel_fork_job -----" 1>&2
trap 'echo "----- exiting cancel_fork_job -----" 1>&2; echo "" 1>&2' EXIT
joboption_lrms=fork
# ARC1 passes first the config file.
if [ "$1" = "--config" ]; then shift; ARC_CONFIG=$1; shift; fi
basedir=`dirname $0`
basedir=`cd $basedir > /dev/null && pwd` || exit $?
pkgdatadir="$basedir"
. ${pkgdatadir}/cancel_common.sh || exit $?
if [ -z "$joboption_controldir" ] ; then
joboption_controldir=`dirname "$arg_file"`
if [ "$joboption_controldir" = '.' ] ; then
joboption_controldir="$PWD"
fi
fi
job_control_dir="$joboption_controldir"
if [ -z "$joboption_gridid" ] ; then
joboption_gridid=`basename "$arg_file" | sed 's/^job\.\(.*\)\.grami$/\1/'`
fi
echo "Deleting job $joboption_gridid, local id $joboption_jobid" 1>&2
if [ ! -r "$job_control_dir/job.${joboption_gridid}.local" ]; then
echo "Local description of job ${joboption_gridid} not found at '$job_control_dir/job.${joboption_gridid}.local'. Job was not killed, if running at all." 1>&2
exit 1
fi
if [ -z "$joboption_jobid" ] ; then
joboption_jobid=`cat "$job_control_dir/job.${joboption_gridid}.local" | grep '^localid=' | sed 's/^localid=//'`
fi
job_control_subdir=
if [ -r "$job_control_dir/accepting/job.${joboption_gridid}.status" ]; then
job_control_subdir="$job_control_dir/accepting"
elif [ -r "$job_control_dir/processing/job.${joboption_gridid}.status" ]; then
job_control_subdir="$job_control_dir/processing"
elif [ -r "$job_control_dir/finished/job.${joboption_gridid}.status" ]; then
job_control_subdir="$job_control_dir/finished"
else
echo "Status file of job ${joboption_gridid} not found in '$job_control_dir'. Job was not killed, if running at all." 1>&2
exit 1
fi
case X`cat "$job_control_subdir/job.${joboption_gridid}.status"` in
XINLRMS | XCANCELING)
if [ -z "$joboption_jobid" ] ; then
echo "Can't find local id of job" 1>&2
exit 1
fi
kill -TERM $joboption_jobid
sleep 5
kill -KILL $joboption_jobid
;;
XFINISHED | XDELETED)
echo "Job already died, won't do anything" 1>&2
;;
*)
echo "Job is at unkillable state" 1>&2
;;
esac
exit 0
|