Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:54:38

0001 #!/bin/bash
0002 
0003 usage='Usage: -r <run number>'
0004 
0005 args=`getopt r: -- "$@"`
0006 if test $? != 0
0007      then
0008          echo $usage
0009          exit 1
0010 fi
0011 
0012 eval set -- "$args"
0013 for i 
0014   do
0015   case "$i" in
0016       -r) shift; run_num=$2;shift;;
0017   esac      
0018 done
0019 
0020 echo 'Checking CRAB status' ${run_num} 
0021 
0022 if [ "X"${run_num} == "X" ]
0023     then
0024     echo "INVALID RUN NUMBER! Please give a valid run number!"
0025     echo $usage
0026     exit 
0027 fi
0028 
0029 # setup crab environment
0030 source /afs/cern.ch/cms/LCG/LCG-2/UI/cms_ui_env.sh;
0031 eval `scramv1 runtime -sh`;
0032 source /afs/cern.ch/cms/ccs/wm/scripts/Crab/crab.sh;
0033 
0034 cd ${run_num};
0035 
0036 crab -status;
0037 nrun=`crab -status 2>&1 | grep -c RUN`;
0038 npend=`crab -status 2>&1 | grep -c PEND`;
0039 ndone=`crab -status 2>&1 | grep -c DONE`;
0040 
0041 if [ "${nrun}" == "0" ] && [ "${npend}" == "0" ]
0042 then
0043     echo "Run "$run_num "is done..." "run:" $nrun "pend:" $npend "done:" $ndone
0044     crab -get
0045 else
0046     echo "Run "$run_num "NOT yet done..." "run:" $nrun "pend:" $npend "done:" $ndone
0047 fi
0048 
0049 #cd -;