Article
Listing 1
Listing 2
Listing 4
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.o
|