| jul92.tar |
Listing 3
1: # 2: # Template for generalized overnight OR background task driver script: 3: # 4: 5: echo # Announce the nature of the application 6: echo "(Name of report)" 7: echo 8: 9: debug=Y # to support testing 10: 11: AppId=report # AppId is short description of application 12: Ltmp=/tmp # Work/Log area for the app, publicly writeable 13: UseLock=Y # Y to use lockfiles, N not to 14: 15: if [ $UseLock = Y ]; then 16: LOCKFILE=$Ltmp/$AppId.LOCK # Name of lockfile 17: LOCKOPT="-l $LOCKFILE" # bgrun.sh lockfile option 18: fi 19: 20: onite=`ask.sh "Do you want to run these reports overnight"` # get Y/N 21: 22: if [ $onite = N ]; then # If requesting background \execution, 23: if [ $UseLock = Y ]; then # and using a lock file, 24: if [ -r $LOCKFILE ]; then # then check for lock file 25: echo "\nSorry, a related report is running. Please try later." 26: exit 1 27: else # no active lockfile found. 28: trap "rm $LOCKFILE; exit 1" 1 2 3 9 14 15 29: touch $LOCKFILE # create the lockfile 30: fi 31: fi 32: fi 33: 34: if [ $debug = Y ]; then # If debugging, create output file 35: outlog=$AppId.out # in the current directory 36: else 37: outlog=$Ltmp/AppId.log # else put in the Temp/Log area 38: fi 39: 40: # 41: # (Get any additional user-specified parameters here) 42: # 43: 44: if [ $onite = N ]; then 45: bgrun.sh $outlog $LOCKOPT <<END 46: # *** insert command here *** 47: [ $UseLock = Y ] && rm $LOCKFILE 48: END 49: echo "This process is now running in the background." 50: echo "The reports will be printed as they are generated" 51: else 52: spoolonite.sh `oname.sh $AppId` <<END 53: # *** insert command here *** 54: END 55: echo 56: echo This process has been scheduled for overnight processing. 57: echo Check for your output tomorrow morning at the selected printer. 58: echo 59: fi
|