runjob.sh 577 Bytes
Newer Older
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
#!/bin/bash

# submit job and get job id
jobid=`qsub --mode c16 --proccount $DARSHAN_DEFAULT_NPROCS -A SSSPPg -t 10 -n 1 --output $DARSHAN_TMP/$$-tmp.out --error $DARSHAN_TMP/$$-tmp.err --debuglog $DARSHAN_TMP/$$-tmp.debuglog "$@"`
if [ $? -ne 0 ]; then
	echo "Error: failed to qsub $@"
	exit 1
fi

output="foo"
rc=0

# loop as long as qstat succeeds and shows information about job
while [ -n "$output" -a "$rc" -eq 0 ]; do
	sleep 5
	output=`qstat $jobid`
	rc=$?
done

# look for return code
grep "exit code of 0" $$-tmp.debuglog
if [ $? -ne 0 ]; then
	exit 1
else
	exit 0
fi