문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top