From c68ffa5fb57aad45e92935a933b82e8ad57232c1 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Tue, 25 Feb 2014 13:02:37 +0200 Subject: [PATCH] fixing cleanup exitcode problem --- anduril/slurm-leastalloc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/anduril/slurm-leastalloc b/anduril/slurm-leastalloc index 323f570..8475fd0 100755 --- a/anduril/slurm-leastalloc +++ b/anduril/slurm-leastalloc @@ -78,10 +78,14 @@ minutes_now=$( date "+%M" ) # send the job srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" - +exitcode=$? # clear out old job definitions (semirandomly) -if [ ! $( date "+%M" ) -eq $minutes_now ] -then find "$JOBROOT" -maxdepth 2 -mindepth 2 -type f -mtime +10 -delete +[[ -e "$JOBROOT"/.lastdel ]] || touch "$JOBROOT"/.lastdel +if test "$( find $JOBROOT/.lastdel -mmin +30 )" +then touch "$JOBROOT"/.lastdel + find "$JOBROOT" -maxdepth 2 -mindepth 2 -type f -mtime +10 -delete find "$JOBROOT" -type d -depth -empty -delete fi +exit $exitcode +