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.



I figured out this by myself.

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

   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'"
       echo "$result"

getsubmitdate SUBMITDATE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.