NWChem/QA/sleep_loopqa.sh
Yuri Victorovich 7b3d60dce7 Fix bash shebangs: make /usr/bin/env find bash in paths
This is needed on FreeBSD and other systems where bash isn't located in /bin/bash.
2021-11-07 14:06:22 -08:00

31 lines
678 B
Bash
Executable file

#!/usr/bin/env bash
#echo "starting sleep_loop.sh for command: " ${@} >& /tmp/out
for last_arg in $@; do :; done
# echo "last arg of ${#} is $last_arg" >& /tmp/out
#"${@}" &
set -- "${@:1:$(($#-1))}"
outfile=../testoutputs/$last_arg
"${@}" >& $outfile &
pid=$!
echo "sleep_loopqa got pid" $pid
ps -p "$pid" > /dev/null
if [[ "${?}" -ne 0 ]];
then
echo ' job stopped ' "${?}"
exit 1
else
while :
do
ps -p "$pid" > /dev/null
ps_exit="${?}"
if [[ "$ps_exit" -eq 0 ]]; then
echo ' ==== ' `date` ' ==== '
tail -3 $outfile
else
break # exit loop.
fi
sleep 30s
done
exit 0
fi
#tail -1 make.log