runjob.sh 644 Bytes
Newer Older
1 2 3
#!/bin/bash

# submit job and get job id
4
jobid=`qsub --env DARSHAN_LOGFILE=$DARSHAN_LOGFILE --mode c16 --proccount $DARSHAN_DEFAULT_NPROCS -A radix-io -t 10 -n 1 --output $DARSHAN_TMP/$$-tmp.out --error $DARSHAN_TMP/$$-tmp.err --debuglog $DARSHAN_TMP/$$-tmp.debuglog "$@"`
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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
Philip Carns's avatar
Philip Carns committed
21
grep "exit code of 0" $DARSHAN_TMP/$$-tmp.debuglog >& /dev/null
22 23 24 25 26
if [ $? -ne 0 ]; then
	exit 1
else
	exit 0
fi