1

I'm using the PBS qsub to run a script on a cluster that must output a report file named with the batch job submit time.

The batch job submit time is the time it joins the PBS batch job que.

I checked all PBS default variables but I didn't find anything related to the job submit time.

I would like to know how can I get this time without creating a new input variable.

Thanks.

1 Answer 1

1

I figured out this by myself.

Add the following function into your PBS batch job script to get the job submit time.

getsubmitdate(){
   local datestring=`qstat -f $PBS_JOBID | grep -F qtime | awk '{for(i=3;i<8;i++) printf $i" "}'`;
   local result=`date -d "$datestring" +%Y%m%d` ;
   local outputvar=$1 ;
   if [[ "$outputvar" ]] ; then
       eval $outputvar="'$result'"
   else
       echo "$result"
   fi
}

getsubmitdate SUBMITDATE
echo $SUBMITDATE

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .