INNER CODE UNIT · Shell
get_status
jdblischak/smk-simple-slurm · extras/status-sacct-robust.sh:15
function get_status(){
sacct -j "$1" --format State --noheader | head -n 1 | awk '{print $1}'
}
for i in {1..5}
do
output=`get_status "$jobid"`
if [[ ! -z $output ]]
then
break
fi
done
if [[ -z $output ]]
then
echo sacct failed to return the status for jobid "$jobid" >&2
echo Maybe you need to use scontrol instead? >&2
exit 1