#! /usr/local/bin/tcsh -f # ----------------------------------------------------------------------------- # # Name : d0user_back.tcsh # # Purpose : C shell script to read the output from d0user # from standard input. It will get the name # of the data file that is currently being # processed and wait for d0user to finish with # this file. This is signaled by # SUB_LEVEL: DONE_WITH_DATA SETUP # This script will then delete the data file and # wait for the next data file. # # Usage : d0ls.tcsh ${sleep_ls} ${purpose_value}| \ # tee $logls | \ # ${executable} | \ # tee $lognt | \ # d0user_back.tcsh | tee $logstat # # Options : # # Arguements : # # Created : 24-MAY-1996 Rob Snihur # Updated : 15-DEC-1996 John Krane Issue standing by message. # Updated : 10-JAN-1997 Rob Snihur Use tcsh and script name variable ${0}. # Updated : 28-JAN-1997 Rob Snihur /usr/local/bin/tcsh # # ----------------------------------------------------------------------------- echo "${0}, standing by" while ( 1 ) # Do forever. set f = `line > g && awk -F: '/Processing / {print $NF}' < g || echo XXXX` # echo $l if ( $#f >= 1 ) then # If f has non-zero number of elements. if ( -e $f ) then # If file f exists. set d = `date` echo ${0} detected that D0user started processing $f at $d while ( 1 ) # Do forever; until data file done. set f_done = `line > h && awk '/DONE_WITH_DATA/ {print $0}' < h || echo XXXX` if ( $#f_done >= 1 ) then # If f_done has non-zero number of elements. set d = `date` echo ${0} detected that D0user finished processing $f at $d echo ${0} deleting $f rm $f break # Exit wait for data file to be done. else if ( $f_done == XXXX ) then # Else reached end of standard input. echo ${0} reached end of standard input echo without having finshed processing $f. exit 1 endif # If f_done has non-zero number of elements. end # Do forever; until data file done. else if ( $f == XXXX ) then # Else reached end of standard input. echo ${0} reached end of standard input successfully. exit 0 endif # If file f exists. endif # If f has non-zero number of elements. end # while ( 1 ); do forever.