#!/bin/bash# Deletes all jobs submitted to OSIRIM platform # given the starting job ID# Duy Dinh, IRIT - University of Toulouse, March. 2012## Syntax:# $sh deleteJobQueue.sh startJobId#startJobID=$1if(test$# -eq 0)thenecho"Start JobID must be specified!"exitelseecho"Deleting jobs after JobID $startJobID"fi# value returned by the split functionarr=();# split a string with a set of delimiters
split(){saveIFS=$IFSIFS="$2"# delimiterarr=($1)# convert string to arrays of strings delimited by a set of delimetersIFS=$saveIFS}# run qstat, get first (jobID) and third (user name) columnstr=$(
/opt/pbs/bin/qstat |
awk 'BEGIN { OFS = ";"; ORS = "\n" } {print $1,$3}')# convert to array of elementselements=($str)i=0while[$i -lt ${#elements[@]}]dos=${elements[$i]}
split $s';'# echo ${arr[1]}iftest${arr[1]}=${USER}then#echo "${arr[0]} ${arr[1]}"
split ${arr[0]}'.'if[[${arr[0]} -gt $startJobID]]thenecho"Deleting job "${arr[0]}
/opt/pbs/bin/qdel ${arr[0]}fifi((i=i+1 ))done
sleep 1
/opt/pbs/bin/qstat
Last edit: Duy Dinh 2013-12-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Last edit: Duy Dinh 2013-12-05