Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:23

0001 #! /bin/bash
0002 
0003 #$1 = login name
0004 STATUS=0
0005 
0006 for logfile in $( ls collect*out* )
0007 do
0008 #echo
0009 echo
0010 #echo "LOGFILE : $logfile"
0011 iter=${logfile##co*ct} 
0012 iter=`expr match "$iter"  '\([0-9]*\)'`
0013 echo "Checking ITER $iter"
0014 
0015 filename="collect.out.gz"
0016 
0017 #echo "Suffix is ${filename:(-2)}"
0018 
0019 ISZIPPED=0
0020 
0021 if [ "${filename:(-2)}" == "gz" ]
0022 then
0023     filename=$(basename $logfile .gz)
0024     gunzip $logfile
0025     ISZIPPED=1
0026 else
0027     filename="$logfile"
0028 fi
0029 
0030            
0031              
0032 if [ $ISZIPPED -lt 3 ]    #this overrides the check and will send an email 
0033                            #also for the previous iterations with problems. Redundant.
0034 #if [ $ISZIPPED -eq 0 ]
0035 then
0036     if ( cat $filename | grep -i 'error'  | grep -i 'unzip')
0037         then 
0038 #echo "===================="
0039 #echo "--- $filename "
0040         let STATUS=$STATUS+1
0041         echo "error from $(hostname): RUnzip erro in collect at iter $iter " | mail -s "--- RUNZIP ERROR in $filename ---" ${1}@mail.cern.ch
0042     fi
0043 fi
0044 
0045 if [ $ISZIPPED -gt 0 ]
0046 then
0047  gzip -f $filename
0048 fi
0049 
0050 done
0051 #echo Returning $STATUS
0052 exit $STATUS