home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume25
/
QBATCH
/
patch01b
< prev
next >
Wrap
Text File
|
1991-11-12
|
54KB
|
1,639 lines
Newsgroups: comp.sources.misc
From: alan@tharr.uucp (Alan Saunders)
Subject: v25i059: QBATCH - a queued batch processing system for UNIX, Patch01b/2
Message-ID: <1991Nov13.040858.19900@sparky.imd.sterling.com>
X-Md4-Signature: c3b6669d124d7adabb1d472a87649dee
Date: Wed, 13 Nov 1991 04:08:58 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: alan@tharr.uucp (Alan Saunders)
Posting-number: Volume 25, Issue 59
Archive-name: QBATCH/patch01b
Environment: UNIX
Patch-To: QBATCH: Volume 25, Issue 20-25
#! /bin/sh
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents: ./patches/qbatch.p1
# Wrapped by kent@sparky on Tue Nov 12 21:47:45 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 2 (of 2)."'
if test -f './patches/qbatch.p1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./patches/qbatch.p1'\"
else
echo shar: Extracting \"'./patches/qbatch.p1'\" \(50591 characters\)
sed "s/^X//" >'./patches/qbatch.p1' <<'END_OF_FILE'
XPrereq: 0
Xdiff -cr ./src/patchlevel.h ../new/src/patchlevel.h
X*** ./src/patchlevel.h Fri Nov 8 08:53:15 1991
X--- ../new/src/patchlevel.h Fri Nov 8 09:59:39 1991
X***************
X*** 1 ****
X! #define PATCHLEVEL 0
X--- 1 ----
X! #define PATCHLEVEL 1
Xdiff -cr ./INSTALL ../new/INSTALL
X*** ./INSTALL Fri Nov 8 08:53:29 1991
X--- ../new/INSTALL Tue Nov 12 14:22:20 1991
X***************
X*** 31,38 ****
X world searchable, but should only be root writeable. SPOOLPATH is
X where the batch files are created, again, the world should be able to
X look at the contents of these files (jcl and monitors), but only root
X! should be able to create and delete them.
X
X Now, if you are not your systems administrator, you are at his (or her)
X mercy. Certain of the QBATCH programs need to be able to set user and
X group id's so they must be owned by root, and setuid. The Makefile
X--- 31,43 ----
X world searchable, but should only be root writeable. SPOOLPATH is
X where the batch files are created, again, the world should be able to
X look at the contents of these files (jcl and monitors), but only root
X! should be able to create and delete them. Also define MAILPATH and
X! SUBJECT to suit your system.
X
X+ If you require queue profile logging to be available, ensure that
X+ LOGGING is defined in qbatch.h, and check that the data being logged
X+ suits your system administrator (in logging.c).
X+
X Now, if you are not your systems administrator, you are at his (or her)
X mercy. Certain of the QBATCH programs need to be able to set user and
X group id's so they must be owned by root, and setuid. The Makefile
X***************
X*** 94,100 ****
X it. If it becomes a problem, you'll have to periodically tidy up
X manually.
X
X! Enjoy ... Alan Saunders August 30 1991
X
X If you do come across any problems, with security or anything else
X relating to QBATCH, please contact me, as I hope you will if you design
X--- 99,105 ----
X it. If it becomes a problem, you'll have to periodically tidy up
X manually.
X
X! Enjoy ... Alan Saunders November 12 1991
X
X If you do come across any problems, with security or anything else
X relating to QBATCH, please contact me, as I hope you will if you design
Xdiff -cr ./MANIFEST ../new/MANIFEST
X*** ./MANIFEST Fri Nov 8 08:53:04 1991
X--- ../new/MANIFEST Tue Nov 12 14:24:10 1991
X***************
X*** 17,22 ****
X--- 17,23 ----
X doc/chap.07 3
X doc/chap.08 3
X doc/chap.09 3
X+ doc/quickstart 0 Notes to get you started using QBATCH
X doc/glossary 2 Limited glossary of terms used
X magic 1
X man 1
X***************
X*** 55,60 ****
X--- 56,62 ----
X src/jn.c 2
X src/jr.c 1
X src/js.c 5
X+ src/logging.c 0
X src/patchlevel.h 1
X src/qagen 1
X src/qbatch.h 2
Xdiff -cr ./NEWS ../new/NEWS
X*** ./NEWS Fri Nov 8 08:53:34 1991
X--- ../new/NEWS Tue Nov 12 16:25:30 1991
X***************
X*** 156,158 ****
X--- 156,214 ----
X and my knowledge of [La]TeX is even less.... Any volunteers?
X
X ..ADS
X+
X+ 7 November 1991
X+
X+ PHEW! I only posted last Friday!
X+
X+ Bug fixes as follows:
X+
X+ Makefile:-
X+ added a missing qt in install target.
X+ added definition of BINDIR to CFLAGS
X+
X+ config.c:-
X+ Missing semicolon at end
X+ spurious entry of setuser() should have been qb_setuser();
X+ #ifdef'd SIGCONT and SIGHALT in toggle_halt_action()
X+ (apparently some systems don't define these signals)
X+
X+ qp.c:-
X+ Changed hardwired directory (how did that get in??) for jobdone script
X+ .. now points to BINDIR.
X+ changed monitor checking code so that if a monitor is specified, and does not
X+ already exist, it is created owned by the submittor not root.
X+
X+ Thanks to Ian Lea of Siemens (Germany) for these. (iian@estevax.uucp)
X+
X+ Added functionality for command string on js command line
X+ New option to js (-c "string"). With this option js does not look for a file of
X+ jcl to subbmit, nor for jcl on stdin but instead creates a jcl file containing
X+ a single shell command line (== string).
X+
X+ Thanks to Ian Lea of Siemens (Germany) for this suggestion. (iian@estevax.uucp)
X+
X+ Added functionality for mailed monitors.
X+ If the default monitor for a queue is MAIL (upper case), or a specified monitor ('-m MAIL'
X+ to js, or MONITOR=MAIL in the environment), then the monitor will be written to a scratch
X+ file, and mailed to the submitting user when the job is complete.
X+
X+ Thanks to Peter Da Silva for this suggestion. (peter@ficc.ferranti.com)
X+
X+ Added functionality for profile time logging.
X+ now #define LOGGING in qbatch.h to enable the logging function, and switch
X+ logging on and off qith the new qc -l option.
X+ logging.c is an implementor configurable c function to write the required
X+ logging data to SPOOLPATH/<queuename>.log. It will be called if the logging
X+ flag (qh_log) is set in the queue header. This flag is toggled with qc -l.
X+
X+ Added -L option to qf and qt to check whether logging is switched on.
X+
X+ This gets around the problem of monitoring queue activity when monitors
X+ are not always in the same file. (private and mailed monitors).
X+
X+ 12 November 1991
X+
X+ Posted qbatch.p1 to comp.sources.misc
X+
X+ .. ADS
XCommon subdirectories: ./doc and ../new/doc
XCommon subdirectories: ./man and ../new/man
XCommon subdirectories: ./src and ../new/src
Xdiff -cr ./doc/chap.01 ../new/doc/chap.01
X*** ./doc/chap.01 Fri Nov 8 08:53:21 1991
X--- ../new/doc/chap.01 Tue Nov 12 13:00:55 1991
X***************
X*** 56,62 ****
X for users to remember to redirect stdout and stderr when running batch
X jobs, this is done automatically by QBATCH. Both stdout and stderr are
X combined into a 'monitor' for the job, which for any given queue and user
X! will always be written to the same place.
X
X D. QBATCH queues can be started and stopped (by the super user) at ANY
X time, even from within a QBATCH job, or from cron. This allows the
X--- 56,62 ----
X for users to remember to redirect stdout and stderr when running batch
X jobs, this is done automatically by QBATCH. Both stdout and stderr are
X combined into a 'monitor' for the job, which for any given queue and user
X! will always be written to an identifiable place.
X
X D. QBATCH queues can be started and stopped (by the super user) at ANY
X time, even from within a QBATCH job, or from cron. This allows the
Xdiff -cr ./doc/chap.02 ../new/doc/chap.02
X*** ./doc/chap.02 Fri Nov 8 08:53:29 1991
X--- ../new/doc/chap.02 Tue Nov 12 13:05:01 1991
X***************
X*** 48,53 ****
X--- 48,56 ----
X SIGCONT to the job, to resume it's processing. If it is unchanged,
X no action will be taken.
X
X+ log. If set, the profile timings of the job are written to a logfile
X+ so that they can be accumulated and analysed.
X+
X stop. If set, when the current job (if any) terminates or is killed, qp
X itself will terminate. If no job is running qp will terminate
X immediately.
X***************
X*** 58,63 ****
X--- 61,67 ----
X
X Programs which alter the settings of these flags are:
X
X+ qc (queue create/change) Toggles the log flag.
X qs (queue stop) Sets the stop, and optionally the kill and or
X repeat flags.
X jk (job kill (remove)) May set the kill flag.
Xdiff -cr ./doc/chap.03 ../new/doc/chap.03
X*** ./doc/chap.03 Fri Nov 8 08:53:21 1991
X--- ../new/doc/chap.03 Tue Nov 12 13:06:30 1991
X***************
X*** 29,34 ****
X--- 29,36 ----
X Enabled. The enabled flag will be set allowing users to submit jobs
X immediately.
X
X+ Logging will be disabled.
X+
X Stopped. There will be no process engine running.
X
X Spooling. The default SPOOLPATH (defined during implementation) will
Xdiff -cr ./doc/chap.04 ../new/doc/chap.04
X*** ./doc/chap.04 Fri Nov 8 08:53:38 1991
X--- ../new/doc/chap.04 Tue Nov 12 13:15:17 1991
X***************
X*** 55,63 ****
X they may use /dev/console instead. (this seems to be the case in SunOS
X on SPARCstations.)
X
X! js will accept the job either as a named file, or from stdin. This
X! allows regularly run jobs to be set up as 'jcl' files, and submitted
X! as:
X js <queuename> <jclfile>
X Alternatively, stdin can be used, either directly:
X js <queuename>
X--- 55,63 ----
X they may use /dev/console instead. (this seems to be the case in SunOS
X on SPARCstations.)
X
X! js will accept the job as a named file, from stdin, or as a single
X! command specified with the -c option. This allows regularly run jobs to be
X! set up as 'jcl' files, and submitted as:
X js <queuename> <jclfile>
X Alternatively, stdin can be used, either directly:
X js <queuename>
X***************
X*** 70,75 ****
X--- 70,80 ----
X [..]
X EOjob
X
X+ For a single command, the job may be submitted as:
X+ js -c <command> <queuename>
X+ e.g.
X+ js -c make work
X+
X If submitted as a file, the 'jcl' may be created in a script, using
X prompts, and shell parameters etc to set it up.
X
X***************
X*** 78,83 ****
X--- 83,96 ----
X
X Main options:
X
X+ -c <command> This allows the submitting user to submit single
X+ commands to a batch queue instead of creating a jcl
X+ file. <command> can be any valid command in the syntax
X+ of the operating shell, but must be self-contained.
X+ (i.e. including any necessary switches and parameters.
X+ If <command> contains spaces it should be enclosed in
X+ quotes.
X+
X -n <name> This provides a meaningful name for the job. It's only
X use is to give some meaning to the ql output (see
X later).
X***************
X*** 206,211 ****
X--- 219,228 ----
X
X -l Provides a one line status report similar to qt -l but with the
X columns headed.
X+
X+ -L Returns the absolute pathspec of the queue's logfile if logging is
X+ turned on. If logging is disabled, returns a message to that
X+ effect to stderr, and fails.
X
X -j jcl. returns the full absolute pathspec of the jcl file created by
X js for this job.
Xdiff -cr ./doc/chap.05 ../new/doc/chap.05
X*** ./doc/chap.05 Fri Nov 8 08:53:34 1991
X--- ../new/doc/chap.05 Tue Nov 12 13:39:07 1991
X***************
X*** 41,46 ****
X--- 41,47 ----
X
X The monitor therefore not only serves to record the output of a job, but
X also to give some indication of it's performance, and resource usage.
X+ (see also 5a LOGGING).
X
X Normally, queue default monitors will be publicly readable, to allow users
X to check on the progress of their jobs. This obviously may be changed by
X***************
X*** 87,92 ****
X--- 88,99 ----
X list will overrule a source earlier (a monitor sourced by specifying -m to
X js will always be used even if a MONITOR environment variable is set.)
X
X+ If a default monitor of "MAIL" is specified to qc for either a new or
X+ existing queue (and no other monitor is specified), or a monitor of "MAIL"
X+ is specified to js, either through the -m option or the environment, then
X+ the monitor for the job will be written to a scratch file, and mailed to
X+ the submitting user on completion.
X+
X If a default monitor of "NONE" is specified to qc for either a new or
X existing queue:
X
X***************
X*** 110,116 ****
X
X 2. Any profile information stored in the monitors will be split up
X across several directories, thus making accounting and tuning more
X! difficult.
X
X 3. using 'more `qf -m <queuename>`' may give startling results when
X used for troubleshooting. (The result will depend on the setting
X--- 117,123 ----
X
X 2. Any profile information stored in the monitors will be split up
X across several directories, thus making accounting and tuning more
X! difficult. (see 5a LOGGING).
X
X 3. using 'more `qf -m <queuename>`' may give startling results when
X used for troubleshooting. (The result will depend on the setting
X***************
X*** 139,141 ****
X--- 146,181 ----
X The 'live' monitor can then be truncated (cat /dev/null><monitorspec>).
X This approach at least keeps the problem manageable.
X
X+ 5a LOGGING.
X+
X+ For the added convenience of the system administrator where monitors are
X+ not generally queue default (either private or mailed monitors), the
X+ LOGGING option is available. LOGGING must be #defined in the Makefile
X+ before compilation to make it available, and the log flag in the queue
X+ header must be set (qc -l <queuename>) to enable it.
X+
X+ If logging is available, and enabled for a queue, then the profile timings
X+ will be written to the queue logfile for each job processed. The logfile
X+ for a queue is SPOOLPATH/<queuename>.log. The data written to this file is
X+ implementor defined, but as released consists of a single line entry for
X+ each job processed. The entry is designed more for program readability
X+ than human, since I feel that when this information is needed, it will also
X+ need to be analysed.
X+
X+ As released, the data logged is:
X+
X+ start time of job (time_t format)
X+ end time of job (time_t format)
X+ user name
X+ uid
X+ gid
X+ job queued time
X+ job process time (real)
X+ job cpu time (user)
X+ job cpu time (system)
X+
X+ (process times are in seconds/100 subject to the accuracy of the system
X+ clock.)
X+
X+ fields in the record are packed (no spaces) with a colon (':') as a
X+ field delimiter.
Xdiff -cr ./doc/chap.07 ../new/doc/chap.07
X*** ./doc/chap.07 Fri Nov 8 08:53:30 1991
X--- ../new/doc/chap.07 Tue Nov 12 13:40:49 1991
X***************
X*** 35,43 ****
X easier to resolve under these conditions, and complaints will be fewer.
X
X c. By monitoring the profile timings of jobs through each queue. The times
X! taken are reported in the monitor for each job processed. They are
X! also accumulated in the queue header. A summary of timings may be
X! displayed at any time with:
X qf -s <queuename>
X A typical display would be:
X
X--- 35,43 ----
X easier to resolve under these conditions, and complaints will be fewer.
X
X c. By monitoring the profile timings of jobs through each queue. The times
X! taken are reported in the monitor for each job processed, and may be
X! separately logged. They are also accumulated in the queue header.
X! A summary of timings may be displayed at any time with:
X qf -s <queuename>
X A typical display would be:
X
Xdiff -cr ./doc/chap.09 ../new/doc/chap.09
X*** ./doc/chap.09 Fri Nov 8 08:53:31 1991
X--- ../new/doc/chap.09 Tue Nov 12 13:41:24 1991
X***************
X*** 6,11 ****
X--- 6,13 ----
X Copyright (c) Vita Services Ltd. 1990 and
X Copyright (c) Vita Fibres Ltd. 1991
X
X+ 9. SECURITY
X+
X Because of the nature of QBATCH, some of the programs have to run setuid
X as root. THIS IS A POTENTIAL SECURITY HOLE!! Unless you ensure that only
X root can copy or write to them. Setuid programs are dangerous unless
Xdiff -cr ./doc/glossary ../new/doc/glossary
X*** ./doc/glossary Fri Nov 8 08:53:22 1991
X--- ../new/doc/glossary Tue Nov 12 13:42:54 1991
X***************
X*** 50,55 ****
X--- 50,59 ----
X js Job submit, Program to submit jobs to a queue for
X queued processing.
X
X+ logfile The file to which profile timing information is written
X+ when LOGGING is available, and logging is enabled for a
X+ queue. It will normally be SPOOLPATH/<queuename>.log
X+
X MANDIR The directory path specified in the Makefile, where
X the manual pages will be installed.
X
Xdiff -cr ./man/js.l ../new/man/js.l
X*** ./man/js.l Fri Nov 8 08:53:22 1991
X--- ../new/man/js.l Tue Nov 12 12:57:28 1991
X***************
X*** 16,21 ****
X--- 16,24 ----
X .B \-dl
X ]
X [
X+ .BI \-c " command string"
X+ ]
X+ [
X .BI \-m " monitor"
X ]
X [
X***************
X*** 46,54 ****
X containing the pathspec of it is placed in the temporary file (-l
X option), or it's contents are copied into the temporary file. If the
X jcl file is not provided, stdin is copied into the temporary file up to
X! an eof. (this allows for piped jcl). An entry is added to the end of
X! the queue file, and if the queue is being processed, a signal is sent
X! to the pid of the process engine for the queue.
X .SH OPTIONS
X .TP 12
X .B \-d
X--- 49,58 ----
X containing the pathspec of it is placed in the temporary file (-l
X option), or it's contents are copied into the temporary file. If the
X jcl file is not provided, stdin is copied into the temporary file up to
X! an eof. (this allows for piped jcl). A command string provided with the -c option
X! creates the jcl with a single command line, instead of expecting commands from a file or stdin.
X! An entry is added to the end of the queue file, and if the queue is being processed, a signal
X! is sent to the pid of the process engine for the queue.
X .SH OPTIONS
X .TP 12
X .B \-d
X***************
X*** 66,71 ****
X--- 70,82 ----
X (and possible script commands and directives in the case of fixed context queues), jcl
X linked in this way must be totally self-contained. The environment is NOT copied in the case
X of a linked job, and this option is not permitted for fixed context queues.
X+ .TP
X+ .BI \-c " command string"
X+ Specify a single line of jcl to be placed in the job file instead of expecting multiple lines
X+ either in a submitted file, or on standard input.
X+ .br
X+ command string should be a self contained command, including all necessary switches and
X+ parameters. If it contains spaces, it should be enclosed in quotes.
X .TP
X .BI \-m " monitor"
X Specify a non-default monitor for this job. If this
Xdiff -cr ./man/qc.l ../new/man/qc.l
X*** ./man/qc.l Fri Nov 8 08:53:35 1991
X--- ../new/man/qc.l Tue Nov 12 10:09:03 1991
X***************
X*** 16,21 ****
X--- 16,24 ----
X .B \- f
X ]
X [
X+ .BI \-l
X+ ]
X+ [
X .BI \-m " monitor"
X ]
X [
X***************
X*** 128,133 ****
X--- 131,146 ----
X If the queue already exists, the -f option will toggle the state of the
X fixed context flag.
X .TP
X+ .B \-l
X+ Toggle the logging status of this queue.
X+ If the queue does not exist (is being created in this operation)
X+ Then the -l flag will cause the logging flag to be set (default is not set).
X+ If the queue already exists, the -l option will toggle the state of the
X+ logging flag.
X+ .sp
X+ If the logging flag is set, the profile timings for jobs processed in this
X+ queue will be written to SPOOLPATH/<queuename>.log.
X+ .TP
X .BI \-m " monitor"
X Specify a default monitor for this queue.
X monitor may be a directory, or a file. If monitor is a directory,
X***************
X*** 138,147 ****
X and -m is not specified then a monitor xxxx.mon in the
X spooling directory will be used.
X .sp
X! A special case is if the monitor specified is "NONE" (in upper case).
X! In this case the user submitting a job to the queue MUST provide a
X monitor specification, either by using the -m option of js, or through
X an environment variable MONITOR.
X .TP
X .BI \-p " priority"
X Specify a priority or 'nice value' at which jobs processed
X--- 151,166 ----
X and -m is not specified then a monitor xxxx.mon in the
X spooling directory will be used.
X .sp
X! Special cases:
X! .br
X! a. If the monitor specified is "NONE" (in upper case).
X! then the user submitting a job to the queue MUST provide a
X monitor specification, either by using the -m option of js, or through
X an environment variable MONITOR.
X+ .sp
X+ b. If the monitor specified is "MAIL" (in upper case), then unless an alternate
X+ monitor is specified through js or the environment, then the monitor will be
X+ mailed to the submitting user.
X .TP
X .BI \-p " priority"
X Specify a priority or 'nice value' at which jobs processed
Xdiff -cr ./man/qf.l ../new/man/qf.l
X*** ./man/qf.l Fri Nov 8 08:53:23 1991
X--- ../new/man/qf.l Tue Nov 12 10:15:19 1991
X***************
X*** 15,20 ****
X--- 15,22 ----
X \-[
X .B a
X ]|[
X+ .B L
X+ ]|[
X .B l
X ]|[
X .B n
X***************
X*** 72,77 ****
X--- 74,85 ----
X .B \-j
X JCL. Reports the full pathspec of the JCL file of the
X first entry in the queue. (Normally the running job.)
X+ .TP
X+ .B \-L
X+ Logging. Reports the full pathspec of the Logging file for the
X+ queue if logging is switched on. (SPOOLPATH/<queuename>.log)
X+ .br
X+ If logging is switched off, a message to that effect is sent to stderr.
X .TP
X .B \-l
X Line. Produces a brief status report on the queue header. The report is headed with the
Xdiff -cr ./man/qt.l ../new/man/qt.l
X*** ./man/qt.l Fri Nov 8 08:53:23 1991
X--- ../new/man/qt.l Tue Nov 12 10:17:39 1991
X***************
X*** 21,26 ****
X--- 21,28 ----
X ]|[
X .B k
X ]|[
X+ .B L
X+ ]|[
X .B l
X ]|[
X .B r
X***************
X*** 66,72 ****
X Kill flag.
X .B qt
X will fail if the kill flag is not set.
X! (last job was not killed) It will not fail if the last job was killed.
X .TP
X .B \-l
X Line. Produces a brief single line status report on the queue header if the user may submit jobs
X--- 68,79 ----
X Kill flag.
X .B qt
X will fail if the kill flag is not set.
X! .TP
X! .B \-L
X! Logging flag.
X! .B qt
X! will fail if the Logging flag is not set.
X! (Job profile times are not being logged) It will not fail if jobs are being logged.
X .TP
X .B \-l
X Line. Produces a brief single line status report on the queue header if the user may submit jobs
Xdiff -cr ./man/queue.l ../new/man/queue.l
X*** ./man/queue.l Fri Nov 8 08:53:24 1991
X--- ../new/man/queue.l Tue Nov 12 10:23:07 1991
X***************
X*** 92,98 ****
X .B qh_defmon
X default monitor for queue
X .br
X! (default is <qh_spool>/<qname>.mon)
X .sp 2
X .TP 0
X .nf
X--- 92,105 ----
X .B qh_defmon
X default monitor for queue
X .br
X! (default is <qh_spool>/<qname>.mon) Normally a pathspec to either a file
X! or a directory into which monitors will be written.
X! .br
X! May also be:
X! .br
X! NONE to force the user to provide a monitor specification, or
X! .br
X! MAIL to mail monitors to the user by default.
X .sp 2
X .TP 0
X .nf
X***************
X*** 104,110 ****
X #define qh_enabled 8 /* accept entries flag */
X #define qh_halt 16 /* suspend processing flag */
X #define qh_fixed 32 /* fixed context processing */
X! #define qh_flagmax 32 /* should be highest above */
X #define qh_action qh_kill + qh_halt /* immediate action flags */
X .sp 2
X .fi
X--- 111,118 ----
X #define qh_enabled 8 /* accept entries flag */
X #define qh_halt 16 /* suspend processing flag */
X #define qh_fixed 32 /* fixed context processing */
X! #define qh_log 64 /* profile logging switch */
X! #define qh_flagmax 64 /* should be highest above */
X #define qh_action qh_kill + qh_halt /* immediate action flags */
X .sp 2
X .fi
Xdiff -cr ./src/Makefile ../new/src/Makefile
X*** ./src/Makefile Fri Nov 8 08:53:32 1991
X--- ../new/src/Makefile Tue Nov 12 16:15:55 1991
X***************
X*** 8,15 ****
X # clean: Remove core files, object files and programs from src.
X # WARNING do NOT make clean before make install!
X # shar: Repackage QBATCH as a shar kit.
X- CFLAG=-g
X- LDFLAG=-Bstatic
X
X # the directory into which to move the binaries
X BINDIR=/usr/local/bin
X--- 8,13 ----
X***************
X*** 20,25 ****
X--- 18,35 ----
X # the bourne shell path
X SHELL=/bin/sh
X
X+ # the path to the mail program.
X+
X+ MAILPATH="/usr/ucb/Mail"
X+
X+ # The subject switch for the mail program. This should be
X+ # the switch syntax which when followed by a string will cause
X+ # the string to be used as the subject line by the mail program
X+ # defined above. If SUBJECT is not defined or is null, the string will
X+ # not be placed in the command line.
X+
X+ SUBJECT="-s"
X+
X # configuration of working paths
X # N.B. Include the quotes and the trailing '/' in the defined string
X # both should be absolute paths (i.e leading '/'
X***************
X*** 30,38 ****
X # where QBATCH creates it's job files and default monitors
X SPOOLPATH="/var/spool/batch/"
X
X! QPATHS=-DQUEUEPATH=\"$(QUEUEPATH)\" -DSPOOLPATH=\"$(SPOOLPATH)\"
X! PROGS=jj jk jm jn jr js qa qc qd qe qf qg qh ql qp qs qt qw rc.QBATCH jobdone
X
X all: $(PROGS)
X @echo "\n\007programs and scripts ... make complete\n"
X
X--- 40,52 ----
X # where QBATCH creates it's job files and default monitors
X SPOOLPATH="/var/spool/batch/"
X
X! CFLAG=-g
X! LDFLAG=-Bstatic
X! QPATHS=-DQUEUEPATH=\"$(QUEUEPATH)\" -DSPOOLPATH=\"$(SPOOLPATH)\" \
X! -DBINDIR=\"$(BINDIR)\" -DMAILPATH=\"$(MAILPATH)\" -DSUBJECT=\"$(SUBJECT)\"
X
X+ PROGS=jj jk jm jn jr js qa qc qd qe qf qg qh ql qp qs qt qw rc.QBATCH jobdone qa
X+
X all: $(PROGS)
X @echo "\n\007programs and scripts ... make complete\n"
X
X***************
X*** 92,99 ****
X cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c -o $@
X chmod 0711 $@
X
X! qp: qp.c qbatch.h config.o time.o
X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o time.o -o $@
X chmod 0700 $@
X
X qs: qs.c qbatch.h config.o
X--- 106,114 ----
X cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c -o $@
X chmod 0711 $@
X
X! qp: qp.c qbatch.h config.o time.o logging.o
X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o time.o \
X! logging.o -o $@
X chmod 0700 $@
X
X qs: qs.c qbatch.h config.o
X***************
X*** 119,127 ****
X config.o: config.c config.h qbatch.h
X cc $(CFLAG) $(QPATHS) -c config.c
X
X! time.o: config.h
X cc $(CFLAG) $(QPATHS) -c time.c
X
X qbatch.h: what.h Makefile
X touch qbatch.h
X
X--- 134,145 ----
X config.o: config.c config.h qbatch.h
X cc $(CFLAG) $(QPATHS) -c config.c
X
X! time.o: time.c config.h
X cc $(CFLAG) $(QPATHS) -c time.c
X
X+ logging.o: logging.c config.h
X+ cc $(CFLAG) $(QPATHS) -c logging.c
X+
X qbatch.h: what.h Makefile
X touch qbatch.h
X
X***************
X*** 132,138 ****
X $(BINDIR)/jr $(BINDIR)/js $(BINDIR)/qa $(BINDIR)/qc \
X $(BINDIR)/qd $(BINDIR)/qe $(BINDIR)/qf $(BINDIR)/qg \
X $(BINDIR)/qh $(BINDIR)/ql $(BINDIR)/qp $(BINDIR)/qs \
X! $(BINDIR)/qw $(BINDIR)/rc.QBATCH $(BINDIR)/jobdone
X @echo "\n\007Installation of programs and scripts complete\n"
X
X make_doc:
X--- 150,157 ----
X $(BINDIR)/jr $(BINDIR)/js $(BINDIR)/qa $(BINDIR)/qc \
X $(BINDIR)/qd $(BINDIR)/qe $(BINDIR)/qf $(BINDIR)/qg \
X $(BINDIR)/qh $(BINDIR)/ql $(BINDIR)/qp $(BINDIR)/qs \
X! $(BINDIR)/qt $(BINDIR)/qw \
X! $(BINDIR)/rc.QBATCH $(BINDIR)/jobdone
X @echo "\n\007Installation of programs and scripts complete\n"
X
X make_doc:
X***************
X*** 197,202 ****
X--- 216,224 ----
X cp $? $(BINDIR)
X
X $(BINDIR)/qs: qs
X+ cp $? $(BINDIR)
X+
X+ $(BINDIR)/qt: qt
X cp $? $(BINDIR)
X
X $(BINDIR)/qw: qw
Xdiff -cr ./src/config.c ../new/src/config.c
X*** ./src/config.c Fri Nov 8 08:53:36 1991
X--- ../new/src/config.c Fri Nov 8 12:08:36 1991
X***************
X*** 56,62 ****
X--- 56,64 ----
X void toggle_halt_status(newaction)
X int newaction;
X {
X+ #ifdef SIGCONT && SIGSTOP
X kill (childid, (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
X+ #endif
X }
X #endif /* NO_PGP */
X
X***************
X*** 72,78 ****
X--- 74,82 ----
X void toggle_halt_status(newaction)
X int newaction;
X {
X+ #ifdef SIGCONT && SIGSTOP
X killpg (childid, (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
X+ #endif
X }
X #endif /* SUNOSPGP */
X
X***************
X*** 88,94 ****
X--- 92,100 ----
X void toggle_halt_status(newaction)
X int newaction;
X {
X+ #ifdef SIGCONT && SIGSTOP
X kill ((childid * -1), (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
X+ #endif
X }
X #endif /* XPG3PGP */
X
X***************
X*** 286,292 ****
X if (had_usersig)
X {
X #ifdef RE_INSTALL
X! setuser();
X #endif
X }
X if (waitid != childid) continue;
X--- 292,298 ----
X if (had_usersig)
X {
X #ifdef RE_INSTALL
X! qb_setuser();
X #endif
X }
X if (waitid != childid) continue;
X***************
X*** 312,317 ****
X pause();
X #endif
X #ifdef RE_INSTALL
X! qb_setuser() /* re-install interrupt handler */
X #endif /* RE_INSTALL */
X }
X--- 318,323 ----
X pause();
X #endif
X #ifdef RE_INSTALL
X! qb_setuser(); /* re-install interrupt handler */
X #endif /* RE_INSTALL */
X }
Xdiff -cr ./src/config.h ../new/src/config.h
X*** ./src/config.h Fri Nov 8 08:53:36 1991
X--- ../new/src/config.h Fri Nov 8 12:18:30 1991
X***************
X*** 132,141 ****
X /*define QCLOCK_TICK gethz();*/
X
X /* Some systems don't define pid_t, if not typedef it here */
X! /*typedef int pid_t*/
X /* and some don't define these */
X! /*typedef short uid_t*/
X! /*typedef short gid_t*/
X
X /* if needed , define these */
X
X--- 132,141 ----
X /*define QCLOCK_TICK gethz();*/
X
X /* Some systems don't define pid_t, if not typedef it here */
X! /*typedef int pid_t;*/
X /* and some don't define these */
X! /*typedef short uid_t;*/
X! /*typedef short gid_t;*/
X
X /* if needed , define these */
X
Xdiff -cr ./src/js.c ../new/src/js.c
X*** ./src/js.c Fri Nov 8 08:53:39 1991
X--- ../new/src/js.c Tue Nov 12 12:44:17 1991
X***************
X*** 15,21 ****
X #include <malloc.h>
X int fpq = 0;
X FILE *fpin, *fpout, *fp;
X! char temp [16], *jcl, *jcwd = NULL;
X int i,j,k, debug = 0;
X int qpuid[10];
X int qpgid[10];
X--- 15,21 ----
X #include <malloc.h>
X int fpq = 0;
X FILE *fpin, *fpout, *fp;
X! char temp [16], *jcl, *jcwd = NULL, *command = NULL;
X int i,j,k, debug = 0;
X int qpuid[10];
X int qpgid[10];
X***************
X*** 130,138 ****
X extern char *optarg;
X extern int optind;
X if (argc == 1) usage (0);
X! while ((c = getopt (argc, argv, "dlm:n:r:s:v")) != -1)
X switch (c)
X {
X case 'd': if (shell[0] == 0) debug ++;
X break;
X case 'l': lflag ++;
X--- 130,140 ----
X extern char *optarg;
X extern int optind;
X if (argc == 1) usage (0);
X! while ((c = getopt (argc, argv, "c:dlm:n:r:s:v")) != -1)
X switch (c)
X {
X+ case 'c': command = optarg;
X+ break;
X case 'd': if (shell[0] == 0) debug ++;
X break;
X case 'l': lflag ++;
X***************
X*** 197,203 ****
X strcpy (monitor, fcptr);
X }
X }
X! if (*monitor != 0)
X {
X if (*monitor != '/') /* monitor should be full pathspec */
X { /* so add current working directory */
X--- 199,205 ----
X strcpy (monitor, fcptr);
X }
X }
X! if ((*monitor != 0) && (strcmp(monitor, "MAIL") != 0))
X {
X if (*monitor != '/') /* monitor should be full pathspec */
X { /* so add current working directory */
X***************
X*** 214,220 ****
X }
X if (access(monitor, W_OK) == 0) /* monitor path is accessible */
X {
X! fp = fopen (monitor, "w");
X if (fp == NULL) /* monitor is a directory */
X {
X if (monitor [strlen(monitor) - 1] != '/')
X--- 216,222 ----
X }
X if (access(monitor, W_OK) == 0) /* monitor path is accessible */
X {
X! fp = fopen (monitor, "a");
X if (fp == NULL) /* monitor is a directory */
X {
X if (monitor [strlen(monitor) - 1] != '/')
X***************
X*** 427,432 ****
X--- 429,439 ----
X optind ++;
X if (optind < argc)
X {
X+ if (command != NULL)
X+ {
X+ fprintf (stderr, "cannot have -c <command> AND job file\n");
X+ qb_exit (-1);
X+ }
X if (argv[optind][0] != '/')
X {
X /* no absolute path given so prefix with current path */
X***************
X*** 438,443 ****
X--- 445,455 ----
X }
X if (lflag && (optind < argc))
X {
X+ if (command != NULL)
X+ {
X+ fprintf (stderr, "cannot have -c <command> AND link file\n");
X+ qb_exit (-1);
X+ }
X fprintf (fpout, "#!L");
X fprintf (fpout, "%s\n", buff);
X if (jobname[0] == 0)
X***************
X*** 459,481 ****
X qb_exit (-1);
X }
X }
X! while (fgets (buff, 128, fpin) != NULL)
X! {
X! fputs (buff, fpout);
X! if (*jobname == 0)
X! {
X! fcptr = strrchr(buff, '\n');
X! if (fcptr != NULL) *fcptr = 0;
X! fcptr = strchr (buff, '=');
X! if (fcptr != NULL)
X! {
X! *fcptr = 0;
X! fcptr ++;
X! if (strcmp (buff, "JOBNAME") == 0)
X! strcpy (jobname, fcptr);
X! }
X! }
X! }
X if (jobname[0] == 0)
X {
X /* no jobname (probably crqentry) so use last line of jcl for name */
X--- 471,501 ----
X qb_exit (-1);
X }
X }
X! if (command != NULL)
X! {
X! fputs (command, fpout);
X! strcpy (buff, command);
X! }
X! else
X! {
X! while (fgets (buff, 128, fpin) != NULL)
X! {
X! fputs (buff, fpout);
X! if (*jobname == 0)
X! {
X! fcptr = strrchr(buff, '\n');
X! if (fcptr != NULL) *fcptr = 0;
X! fcptr = strchr (buff, '=');
X! if (fcptr != NULL)
X! {
X! *fcptr = 0;
X! fcptr ++;
X! if (strcmp (buff, "JOBNAME") == 0)
X! strcpy (jobname, fcptr);
X! }
X! }
X! }
X! }
X if (jobname[0] == 0)
X {
X /* no jobname (probably crqentry) so use last line of jcl for name */
Xdiff -cr ./src/qbatch.h ../new/src/qbatch.h
X*** ./src/qbatch.h Fri Nov 8 08:53:26 1991
X--- ../new/src/qbatch.h Tue Nov 12 16:04:04 1991
X***************
X*** 6,11 ****
X--- 6,14 ----
X /* (c) Vita Fibres 1990 1991 */
X /* */
X /************************************************************************/
X+ /* first define whether you want queue logging enabled */
X+ #define LOGGING
X+
X #include <stdio.h>
X #include <string.h>
X #include <sys/file.h>
X***************
X*** 24,30 ****
X #define qh_enabled 8 /* accept entries flag */
X #define qh_halt 16 /* suspend processing flag */
X #define qh_fixed 32 /* fixed context processing */
X! #define qh_flagmax 32 /* should be highest above */
X #define qh_action qh_kill + qh_halt /* immediate action flags */
X
X struct queue_header {
X--- 27,34 ----
X #define qh_enabled 8 /* accept entries flag */
X #define qh_halt 16 /* suspend processing flag */
X #define qh_fixed 32 /* fixed context processing */
X! #define qh_log 64 /* logging switched on */
X! #define qh_flagmax 64 /* should be highest above */
X #define qh_action qh_kill + qh_halt /* immediate action flags */
X
X struct queue_header {
Xdiff -cr ./src/qc.c ../new/src/qc.c
X*** ./src/qc.c Fri Nov 8 08:53:32 1991
X--- ../new/src/qc.c Fri Nov 8 12:35:49 1991
X***************
X*** 16,22 ****
X
X #include <stdlib.h>
X #include "qbatch.h"
X! int mflag, sflag = 0, pflag = 0, pval = 0, fixedcontext = 0;
X char *queuename;
X char queue [64];
X char qpath [64];
X--- 16,22 ----
X
X #include <stdlib.h>
X #include "qbatch.h"
X! int mflag, sflag = 0, pflag = 0, pval = 0, fixedcontext = 0, logging = 0;;
X char *queuename;
X char queue [64];
X char qpath [64];
X***************
X*** 36,42 ****
X fprintf (stderr, "Must be root to create a queue\n");
X qb_term (-1);
X }
X! while ((c = getopt (argc, argv, "fm:p:s:v")) != -1)
X switch (c)
X {
X case 's':
X--- 36,42 ----
X fprintf (stderr, "Must be root to create a queue\n");
X qb_term (-1);
X }
X! while ((c = getopt (argc, argv, "flm:p:s:v")) != -1)
X switch (c)
X {
X case 's':
X***************
X*** 50,55 ****
X--- 50,58 ----
X case 'f':
X fixedcontext ++;
X break;
X+ case 'l':
X+ logging ++;
X+ break;
X case 'm':
X strcpy (monitor, optarg);
X mflag ++;
X***************
X*** 77,83 ****
X }
X }
X else strcpy (qpath, SPOOLPATH);
X! if ((monitor[0] != 0) && (strcmp (monitor, "NONE")) != 0)
X {
X if (strlen (monitor) > 63)
X {
X--- 80,86 ----
X }
X }
X else strcpy (qpath, SPOOLPATH);
X! if ((monitor[0] != 0) && (strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0))
X {
X if (strlen (monitor) > 63)
X {
X***************
X*** 118,124 ****
X }
X else
X {
X! if (strcmp (monitor, "NONE") != 0)
X {
X strcpy (monitor, qpath);
X if (monitor[strlen(monitor) -1] != '/') strcat (monitor, "/");
X--- 121,127 ----
X }
X else
X {
X! if ((strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0))
X {
X strcpy (monitor, qpath);
X if (monitor[strlen(monitor) -1] != '/') strcat (monitor, "/");
X***************
X*** 174,179 ****
X--- 177,188 ----
X if ((head.qh_flags & qh_fixed) == 0)
X head.qh_flags += (unsigned int) qh_fixed;
X else head.qh_flags -= (unsigned int) qh_fixed;
X+ }
X+ if (logging)
X+ {
X+ if ((head.qh_flags & qh_log) == 0)
X+ head.qh_flags += (unsigned int) qh_log;
X+ else head.qh_flags -= (unsigned int) qh_log;
X }
X lseek (fpq, 0, SEEK_SET);
X write (fpq, &head, sizeof(head));
Xdiff -cr ./src/qf.c ../new/src/qf.c
X*** ./src/qf.c Fri Nov 8 08:53:40 1991
X--- ../new/src/qf.c Tue Nov 12 09:36:36 1991
X***************
X*** 11,17 ****
X #include <stdlib.h>
X #include "qbatch.h"
X int mflag = 0, jflag = 0, qflag = 0, pflag = 0, aflag = 0,rflag = 0, sflag = 0, nflag = 0;
X! int lflag = 0;
X char buff[128];
X FILE *fpq, *fp;
X char *queuename;
X--- 11,17 ----
X #include <stdlib.h>
X #include "qbatch.h"
X int mflag = 0, jflag = 0, qflag = 0, pflag = 0, aflag = 0,rflag = 0, sflag = 0, nflag = 0;
X! int lflag = 0, Lflag=0;
X char buff[128];
X FILE *fpq, *fp;
X char *queuename;
X***************
X*** 93,99 ****
X int c;
X extern char *optarg;
X extern int optind;
X! while ((c = getopt (argc, argv, "ae:jlmnpqrsv")) != -1)
X switch (c)
X {
X case 'q':
X--- 93,99 ----
X int c;
X extern char *optarg;
X extern int optind;
X! while ((c = getopt (argc, argv, "ae:jLlmnpqrsv")) != -1)
X switch (c)
X {
X case 'q':
X***************
X*** 102,107 ****
X--- 102,110 ----
X case 'j':
X jflag ++;
X break;
X+ case 'L':
X+ Lflag ++;
X+ break;
X case 'l':
X lflag ++;
X break;
X***************
X*** 180,185 ****
X--- 183,202 ----
X printf("%d\n", head.qh_noentries);
X fclose (fpq);
X exit (0);
X+ }
X+ if (Lflag != 0)
X+ {
X+ if ((head.qh_flags & qh_log) != 0)
X+ {
X+ printf("%s",head.qh_spool);
X+ if (head.qh_spool[strlen(head.qh_spool) -1] != '/')
X+ printf("/");
X+ printf ("%s.log\n", queuename);
X+ exit(0);
X+ }
X+ else
X+ fprintf (stderr, "Logging is switched off for %s\n", queuename);
X+ exit (-1);
X }
X if (rflag != 0)
X {
Xdiff -cr ./src/qp.c ../new/src/qp.c
X*** ./src/qp.c Fri Nov 8 08:53:41 1991
X--- ../new/src/qp.c Tue Nov 12 12:31:25 1991
X***************
X*** 11,27 ****
X
X #include "qbatch.h"
X #include <malloc.h>
X! int fpq = 0,
X! fplck = 0,
X! fptemp = 0;
X! result,
X! interrupt = 0;
X FILE *fpin,
X *mon;
X struct tm *jtimes;
X char exit_message[64];
X char envflg[5], envvar[255];
X! char temp[16],
X *jcl,
X *jcwd = NULL;
X int i,
X--- 11,34 ----
X
X #include "qbatch.h"
X #include <malloc.h>
X!
X! /* pointers to qp's structures for external use (in logging.c) */
X! struct queue_header * ehead = &head;
X! struct queue_entry * eentry = &entry;
X!
X! int fpq = 0;
X! int fplck = 0;
X! int fptemp = 0;
X! int result;
X! int interrupt = 0;
X! int mail = 0;
X FILE *fpin,
X *mon;
X struct tm *jtimes;
X+ time_t end_time;
X char exit_message[64];
X char envflg[5], envvar[255];
X! char temp[128],
X *jcl,
X *jcwd = NULL;
X int i,
X***************
X*** 229,235 ****
X write (fplck, &ppid, sizeof(ppid));
X fsync(fplck);
X head.qh_pid = ppid; /* set up header data .. */
X! head.qh_flags &= (qh_enabled+qh_fixed); /* ,..flags */
X head.qh_proc = time ((time_t *) 0); /* set up start time */
X head.qh_queued = 0;
X head.qh_real = 0;
X--- 236,242 ----
X write (fplck, &ppid, sizeof(ppid));
X fsync(fplck);
X head.qh_pid = ppid; /* set up header data .. */
X! head.qh_flags &= (qh_enabled+qh_fixed+qh_log); /* ,..flags */
X head.qh_proc = time ((time_t *) 0); /* set up start time */
X head.qh_queued = 0;
X head.qh_real = 0;
X***************
X*** 300,315 ****
X else
X { /* get entry and fork it */
X read (fpq, &entry, sizeof (entry));
X! if (entry.qe_monitor[0] != 0)
X {
X mon = fopen (entry.qe_monitor, "a");
X }
X else
X {
X! mon = fopen (head.qh_defmon, "a");
X }
X head.qh_start = time ((time_t *) 0); /* set up start time */
X! q_queued = head.qh_start - entry.qe_submitted;
X jtimes = (struct tm *)localtime (&head.qh_start);
X fprintf (mon, "##\n## Queue %s entry %d (uid = %d : %s) Job: %s\n"
X ,queuename, entry.qe_jobno, entry.qe_uid, entry.qe_uname, entry.qe_jobname);
X--- 307,355 ----
X else
X { /* get entry and fork it */
X read (fpq, &entry, sizeof (entry));
X! if ((strcmp (entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0))
X {
X+ /* check if non-default monitor can be accessed */
X+ mon = fopen(entry.qe_monitor, "r");
X+ if (mon == NULL)
X+ {
X+ /* either does not exist or no access */
X+ /* so try to create it */
X+ i = open (entry.qe_monitor, O_CREAT+O_EXCL, 0644);
X+ if (i == -1)
X+ {
X+ /* must exist but no access */
X+ fprintf (stderr, "Cannot access monitor\n");
X+ qb_exit(-1);
X+ }
X+ /* created, so close, and change owner and group */
X+ /* to that of submittor */
X+ close (i);
X+ chown (entry.qe_monitor, entry.qe_uid, entry.qe_gid);
X+ }
X+ else fclose (mon);
X mon = fopen (entry.qe_monitor, "a");
X }
X else
X {
X! if ((strcmp (entry.qe_monitor, "MAIL") == 0) || (strcmp (head.qh_defmon, "MAIL") == 0))
X! {
X! mail = 1;
X! strcpy (temp, head.qh_spool);
X! if (temp[strlen(temp) -1] != '/') strcat (temp, "/");
X! strcat(temp, "qmonXXXXXX");
X! mktemp(temp);
X! mon = fopen(temp,"w");
X! }
X! else
X! {
X! mail = 0;
X! mon = fopen (head.qh_defmon, "a");
X! chmod (head.qh_defmon, 0644);
X! }
X }
X head.qh_start = time ((time_t *) 0); /* set up start time */
X! q_queued = (head.qh_start - entry.qe_submitted)*100;
X jtimes = (struct tm *)localtime (&head.qh_start);
X fprintf (mon, "##\n## Queue %s entry %d (uid = %d : %s) Job: %s\n"
X ,queuename, entry.qe_jobno, entry.qe_uid, entry.qe_uname, entry.qe_jobname);
X***************
X*** 386,392 ****
X envs[j++] = qentry;
X j = 0;
X jtimes = (struct tm *)localtime (&head.qh_start);
X! if (entry.qe_monitor[0] != 0)
X {
X mon = freopen (entry.qe_monitor, "a", stdout);
X mon = freopen (entry.qe_monitor, "a", stderr);
X--- 426,432 ----
X envs[j++] = qentry;
X j = 0;
X jtimes = (struct tm *)localtime (&head.qh_start);
X! if ((entry.qe_monitor[0] != 0) && (strcmp (entry.qe_monitor, "MAIL") !=0))
X {
X mon = freopen (entry.qe_monitor, "a", stdout);
X mon = freopen (entry.qe_monitor, "a", stderr);
X***************
X*** 393,400 ****
X }
X else
X {
X! mon = freopen (head.qh_defmon, "a", stdout);
X! mon = freopen (head.qh_defmon, "a", stderr);
X }
X if (setuid (entry.qe_uid) != 0)
X {
X--- 433,448 ----
X }
X else
X {
X! if (mail)
X! {
X! mon = freopen (temp, "a", stdout);
X! mon = freopen (temp, "a", stderr);
X! }
X! else
X! {
X! mon = freopen (head.qh_defmon, "a", stdout);
X! mon = freopen (head.qh_defmon, "a", stderr);
X! }
X }
X if (setuid (entry.qe_uid) != 0)
X {
X***************
X*** 420,426 ****
X /*
X set child on track, now update queue and wait for it to finish
X */
X! head.qh_flags &= (qh_enabled+qh_fixed); /* ,..flags */
X entry.qe_status = childid; /* and entry status */
X lseek (fpq, 0, SEEK_SET);
X head.qh_pid = ppid;
X--- 468,474 ----
X /*
X set child on track, now update queue and wait for it to finish
X */
X! head.qh_flags &= (qh_enabled+qh_fixed+qh_log); /* ,..flags */
X entry.qe_status = childid; /* and entry status */
X lseek (fpq, 0, SEEK_SET);
X head.qh_pid = ppid;
X***************
X*** 433,448 ****
X q_wait(exit_message);
X qb_get_timer(&q_real, &q_user, &q_system);
X childid = 0;
X! if (entry.qe_monitor[0] != 0)
X {
X mon = fopen (entry.qe_monitor, "a");
X }
X else
X {
X! mon = fopen (head.qh_defmon, "a");
X }
X! head.qh_start = time ((time_t *) 0); /* set up end time */
X! jtimes = (struct tm *)localtime (&head.qh_start);
X fprintf (mon, "##\n## Queue %s entry %d (uid = %d : %s) Job: %s\n"
X ,queuename, entry.qe_jobno, entry.qe_uid, entry.qe_uname, entry.qe_jobname);
X fprintf (mon, "## stopped %s" ,asctime (jtimes));
X--- 481,497 ----
X q_wait(exit_message);
X qb_get_timer(&q_real, &q_user, &q_system);
X childid = 0;
X! if ((strcmp(entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0))
X {
X mon = fopen (entry.qe_monitor, "a");
X }
X else
X {
X! if (mail) mon = fopen (temp, "a");
X! else mon = fopen (head.qh_defmon, "a");
X }
X! end_time = time ((time_t *) 0); /* set up end time */
X! jtimes = (struct tm *)localtime (&end_time);
X fprintf (mon, "##\n## Queue %s entry %d (uid = %d : %s) Job: %s\n"
X ,queuename, entry.qe_jobno, entry.qe_uid, entry.qe_uname, entry.qe_jobname);
X fprintf (mon, "## stopped %s" ,asctime (jtimes));
X***************
X*** 454,464 ****
X fprintf (mon, "## (%s)\n", exit_message);
X fprintf (mon,"##\n");
X fclose (mon);
X }
X if (entry.qe_notify > 0)
X {
X /* notify user */
X! sprintf (buff, "/usr/bin/bv/jobdone %s %d %d %s %s \"%s\"", queuename, entry.qe_jobno, entry.qe_notify, entry.qe_uname, entry.qe_tty, entry.qe_jobname);
X system (buff);
X }
X fpq = open (queue, O_RDWR);
X--- 503,531 ----
X fprintf (mon, "## (%s)\n", exit_message);
X fprintf (mon,"##\n");
X fclose (mon);
X+ #ifdef LOGGING
X+ if ((head.qh_flags & qh_log) != 0) q_log();
X+ #endif
X+ if (mail)
X+ {
X+ mon = fopen (temp, "r");
X+ #ifdef SUBJECT
X+ sprintf (path, "%s %s \"Monitor for your job in \'%s\' queue\" %s", MAILPATH, SUBJECT, queuename, entry.qe_uname);
X+ #else
X+ sprintf (path, "%s %s", MAILPATH, entry.qe_uname);
X+ #endif /* SUBJECT */
X+ fpin = popen (path, "w");
X+ while (fgets (buff, 128, mon) != NULL)
X+ fputs (buff, fpin);
X+ fclose (mon);
X+ pclose (fpin);
X+ unlink(temp);
X+ }
X }
X if (entry.qe_notify > 0)
X {
X /* notify user */
X! sprintf (buff, "%s/jobdone %s %d %d %s %s \"%s\"", BINDIR, queuename, entry.qe_jobno, entry.qe_notify, entry.qe_uname, entry.qe_tty, entry.qe_jobname);
X system (buff);
X }
X fpq = open (queue, O_RDWR);
X***************
X*** 465,471 ****
X q_lock(fpq);
X read (fpq, &head, sizeof(head));
X head.qh_start = 0;
X! head.qh_queued += (q_queued*100);
X head.qh_real += q_real;
X head.qh_user += q_user;
X head.qh_system += q_system;
X--- 532,538 ----
X q_lock(fpq);
X read (fpq, &head, sizeof(head));
X head.qh_start = 0;
X! head.qh_queued += q_queued;
X head.qh_real += q_real;
X head.qh_user += q_user;
X head.qh_system += q_system;
Xdiff -cr ./src/qt.c ../new/src/qt.c
X*** ./src/qt.c Fri Nov 8 08:53:27 1991
X--- ../new/src/qt.c Tue Nov 12 09:58:07 1991
X***************
X*** 40,46 ****
X }
X void usage()
X {
X! puts("Usage: qt -[e]|[f]|[h]|[k]|[r]|[s]|[u]|[t]|[v] <queuename>");
X exit (0);
X }
X void ext(flag)
X--- 40,46 ----
X }
X void usage()
X {
X! puts("Usage: qt -[e]|[f]|[h]|[k]|[l]|[L]|[r]|[s]|[u]|[t]|[v] <queuename>");
X exit (0);
X }
X void ext(flag)
X***************
X*** 63,69 ****
X {
X extern char *optarg;
X extern int optind;
X! if ((c = getopt (argc, argv, "efhklrstuv")) == -1) usage();
X if (c == 'v') q_version();
X if (optind >= argc)
X {
X--- 63,69 ----
X {
X extern char *optarg;
X extern int optind;
X! if ((c = getopt (argc, argv, "efhkLlrstuv")) == -1) usage();
X if (c == 'v') q_version();
X if (optind >= argc)
X {
X***************
X*** 96,101 ****
X--- 96,102 ----
X case 'k': ext (head.qh_flags & qh_kill);
X case 'r': ext (head.qh_flags & qh_repeat);
X case 's': ext (head.qh_flags & qh_stop);
X+ case 'L': ext (head.qh_flags & qh_log);
X }
X /* done the rest, must be -u or -l*/
X if ((head.qh_flags & qh_fixed) == 0)
Xdiff -cr ./src/whatgen ../new/src/whatgen
X*** ./src/whatgen Fri Nov 8 08:53:20 1991
X--- ../new/src/whatgen Tue Nov 12 09:00:04 1991
X***************
X*** 9,12 ****
X #************************************************************************#
X set `cat patchlevel.h`
X echo "static char QbSID[]= \042@(#) QBATCH (c) \tVersion: 2.$3 \
X! (4 October 1991)\042;">what.h
X--- 9,12 ----
X #************************************************************************#
X set `cat patchlevel.h`
X echo "static char QbSID[]= \042@(#) QBATCH (c) \tVersion: 2.$3 \
X! (12 November 1991)\042;">what.h
END_OF_FILE
if test 50591 -ne `wc -c <'./patches/qbatch.p1'`; then
echo shar: \"'./patches/qbatch.p1'\" unpacked with wrong size!
fi
# end of './patches/qbatch.p1'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked both archives.
rm -f ark[1-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.