diff --git a/bin/qlogin_wrapper b/bin/qlogin_wrapper new file mode 100755 index 0000000..8d91e4f --- /dev/null +++ b/bin/qlogin_wrapper @@ -0,0 +1,5 @@ +#!/bin/sh +# $Id: qlogin_wrapper 175 2010-09-15 15:34:28Z kasper $ +HOST=$1 +PORT=$2 +/usr/bin/ssh -XAq -p $PORT $USER@$HOST diff --git a/bin/suspend.sh b/bin/suspend.sh new file mode 100755 index 0000000..80647c0 --- /dev/null +++ b/bin/suspend.sh @@ -0,0 +1,25 @@ +#!/usr/bin/ksh +# $Id: suspend.sh 365 2013-11-18 09:58:17Z kasper $ +# This script should be added as the SUSPEND_METHOD in the +# queue definition with a $job_pid, $job_id, and $job_owner arguments. +# e.g. script.sh $job_pid $job_id $job_owner + +if [ -z "$3" ] +then + echo "Usage: $0 \$job_pid \$job_id \$job_owner" + exit 1 +fi + +stat=`pgrep -g $1` +if [ ! -z "$stat" ] +then + #echo "Sending $sig to $1" >> ~$3/qdel_log.log + /usr/bin/pkill --signal SIGTSTP -g $1 +else + echo "Process $1 not found for job $2" >> ~$3/qdel_log.log + echo "Unable to suspend." >> ~$3/qdel_log.log + exit 1 +fi + +#uncomment the following for debugging +#echo "Suspending Job $2 " >> ~$3/qdel_log.log diff --git a/bin/term.sh b/bin/term.sh new file mode 100755 index 0000000..bb19e72 --- /dev/null +++ b/bin/term.sh @@ -0,0 +1,30 @@ +#!/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 diff --git a/epilog.d/99-rm_empty_logs.sh b/epilog.d/99-rm_empty_logs.sh new file mode 100755 index 0000000..0e636dc --- /dev/null +++ b/epilog.d/99-rm_empty_logs.sh @@ -0,0 +1,11 @@ +#! /bin/bash +# $Id: epilog 181 2010-09-17 15:55:28Z kasper $ + +## Delete the STDOUT and STDERR files (.o and .e) if they are empty +## ( we do not want to delete non-empty files, they may contain useful +## troubleshooting or debug information ... ) +## +[ -r $SGE_STDOUT_PATH -a -f $SGE_STDOUT_PATH ] && [ ! -s $SGE_STDOUT_PATH ] && rm -f $SGE_STDOUT_PATH +[ -r $SGE_STDERR_PATH -a -f $SGE_STDERR_PATH ] && [ ! -s $SGE_STDERR_PATH ] && rm -f $SGE_STDERR_PATH + +exit 0