| jul92.tar |
Listing 4
1: # 2: # Actual generalized background/overnight script driver, for 3: # generating a set of Informix reports with different parameters: 4: # 5: # The user is prompted for a printer name (printer), and a series of 6: # magazine (mag) and source code (sc) pairs. For each such pair, the 7: # report generation command: 8: # sacego -q swkpay $mag $sc | lp -d$printer 9: # is generated, and all such commands are collected in a script file 10: # named $list. 11: # 12: # Finally, this script file is submitted to either spoolonite.sh or 13: # bgrun.sh, as specified by the user. 14: # 15: 16: echo 17: echo Reports of Subscription Payment History by Source Code 18: echo 19: 20: debug=Y # to support testing 21: 22: AppId=orig # AppId is short description of application 23: Ltmp=/u3/Srcrep/Ltmp # Work/Log area for the app, publicly writeable 24: UseLock=Y # Y to use lockfiles, N not to 25: 26: if [ $UseLock = Y ]; then 27: LOCKFILE=$Ltmp/$AppId.LOCK # Name of lockfile 28: LOCKOPT="-l $LOCKFILE" # bgrun.sh lockfile option 29: fi 30: 31: onite=`ask.sh "Do you want to run these reports overnight"` # get Y/N 32: 33: if [ $onite = N ]; then # If requesting background execution, 34: if [ $UseLock = Y ]; then # and using a lock file, 35: if [ -r $LOCKFILE ]; then # then check for lock file 36: echo "\nSorry, a related report is running. Please try later." 37: exit 1 38: else # no active lockfile found. 39: trap "rm $LOCKFILE; exit 1" 1 2 3 9 14 15 40: touch $LOCKFILE # create the lockfile 41: fi 42: fi 43: fi 44: 45: if [ $debug = Y ] 46: then # If debugging, create output file 47: outlog=$AppId.out # in the current directory 48: else 49: outlog=$Ltmp/$AppId.log # else put in the Temp/Log area 50: fi 51: 52: # 53: # Get parameters specific to this report program: 54: # 55: 56: printer=`getptr p` # prompt user for printer selection (internal utility) 57: list=`tmpname src` # script file to recieve report generation commands 58: 59: echo 60: echo You will now be given the opportunity to enter a list of 61: echo source/magazine pairs. Enter an empty source code when all desired 62: echo reports have been entered. 63: echo 64: 65: while true 66: do 67: echo 68: echo "Please enter the source code to profile (Return alone when done) -> \c" 69: read sc 70: [ "$sc" = "" ] && break # null code terminates report list 71: mag=`getmag` # prompt for publication code (internal utility) 72: cat >>$list <<-END # append the report generation command to script 73: sacego -q swkpay $mag $sc | lp -d$printer 74: END 75: done 76: 77: if [ $onite = N ]; then 78: [ $UseLock = Y ] && echo "rm $LOCKFILE" >>$list 79: bgrun.sh $outlog $LOCKOPT < $list 80: echo "This process is now running in the background." 81: echo "The reports will be printed as they are generated" 82: else 83: spoolonite.sh `oname.sh $AppId` <$list 84: echo 85: echo This process has been scheduled for overnight processing. 86: echo Check for your output tomorrow morning at the selected printer. 87: echo 88: fi 89: 90: [ $debug = N ] && rm $list
|