home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: alan@tharr.uucp (Alan Saunders)
- Subject: v26i070: QBATCH - a queued batch processing system for UNIX, Patch02
- Message-ID: <1991Nov26.034904.1196@sparky.imd.sterling.com>
- X-Md4-Signature: 51416bf6930797be52e9b4981f60ebf8
- Date: Tue, 26 Nov 1991 03:49:04 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: alan@tharr.uucp (Alan Saunders)
- Posting-number: Volume 26, Issue 70
- Archive-name: QBATCH/patch02
- Environment: UNIX
- Patch-To: QBATCH: Volume 25, Issue 20-25
-
- I have been unable to contact tharr for a couple of days, since they have
- had problems. If anyone has had mail to me returned, could they please
- re-send it.. Thanks.
-
- Should have waited a day or two more for all the response to get in before
- issuing p1!
-
- Bugs: A few more typos in config.c! Realised I don't need to have the
- facilities (functions) available on my system to compile with all variations
- of defines to see if config.c is syntactically correct. I've now done this,
- and if anyone finds more typos I'll scream!!
-
- Long environment variables overwriting other data in js.c (and qp.c) (see
- changes) Environment variables were being copied into buff without a length
- check, changed so only (QBUFLEN-1) characters are copied.
-
- Changes: Length (and number) of environment variables seems to be causing
- most problems. There are two new defines in Makefile:
-
- QBUFLEN defines the size of buffer used to grab environment variables
- (amongst other things) in js, and to place them in the table
- in qp. Set it to at least 1 greater than the maximum
- environment string length (including the environment name and
- the '='). Also used for reading the input file in js, so it
- must also be larger than the largest input line.
-
- QMAXENV defines the size of the environment table passed to the
- running job by qp. Set it to at least 4 greater than the
- maximum number of environment variables to be passed (3 used by
- QBATCH and a trailing NULL pointer).
-
- Also found envvar writing all over everywhere when transferring large (>255
- char) environment variables to the table, changed envvar to a char * pointing
- into buff1.
-
- Minor cosmetic changes to qf (-s) option .. not reporting current job if it
- is the first one since the queue started.
-
- 14 November 1991
-
- Cosmetic change in logging.c.. no need for end time since:
-
- end time = start time + ((queued + real)/100)
-
- so first two fields are now start date and time in a more human readable form
- (yyyymm/dd:HH.MM.SS)
-
- For anyone who hasn't worked it out :-), user response time (the time between
- submitting a job, and the job's completion) is:
-
- response time = end time - start time
-
- Alan
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: patches/qbatch.p2
- # Wrapped by root@vfib_d on Fri Nov 15 07:41:52 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches/qbatch.p2' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches/qbatch.p2'\"
- else
- echo shar: Extracting \"'patches/qbatch.p2'\" \(28288 characters\)
- sed "s/^X//" >'patches/qbatch.p2' <<'END_OF_FILE'
- Prereq: 1
- Index: src/patchlevel.h
- X***************
- X*** 1 ****
- X! #define PATCHLEVEL 1
- X--- 1 ----
- X! #define PATCHLEVEL 2
- Index: INSTALL
- X***************
- X*** 1,5 ****
- X
- X! QBATCH Version 2.0 Installation notes and bewares
- X
- X The QBATCH system and its related programs were
- X written by Alan D. Saunders and are
- X--- 1,5 ----
- X
- X! QBATCH Version 2 Installation notes and bewares
- X
- X The QBATCH system and its related programs were
- X written by Alan D. Saunders and are
- X***************
- X*** 32,38 ****
- 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--- 32,42 ----
- 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. If necessary also change QBUFLEN to
- X! suit the size of environment variables passed to running jobs, and
- X! the length of lines in input job files. Set QMAXENV to suit the
- X! maximum number of environment variables to be passed to the job
- X! (including 3 extra for QBATCH and 1 for a trailing NULL pointer).
- 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
- Index: NEWS
- X***************
- X*** 1,4 ****
- X! Current release of QBATCH version 2.0 Aug 30 1991
- X
- X The QBATCH system and its related programs were
- X written by Alan D. Saunders and are
- X--- 1,4 ----
- X! Current release of QBATCH version 2 Aug 30 1991
- X
- X The QBATCH system and its related programs were
- X written by Alan D. Saunders and are
- X***************
- X*** 211,214 ****
- X--- 211,267 ----
- X
- X Posted qbatch.p1 to comp.sources.misc
- X
- X+ Current version is 2.1
- X+
- X .. ADS
- X+
- X+ 13 November 1991
- X+
- X+ Should have waited a day or two more for all the response to get in before
- X+ issuing p1!
- X+
- X+ Bugs:
- X+ A few more typos in config.c!
- X+ Realised I don't need to have the facilities (functions) available on my system
- X+ to compile with all variations of defines to see if config.c is syntactically
- X+ correct. I've now done this, and if anyone finds more typos I'll scream!!
- X+
- X+ Long environment variables overwriting other data in js.c (and qp.c)
- X+ (see changes) Environment variables were being copied into buff without a
- X+ length check, changed so only (QBUFLEN-1) characters are copied.
- X+
- X+ Changes:
- X+ Length (and number) of environment variables seems to be causing most problems.
- X+ There are two new defines in Makefile:
- X+
- X+ QBUFLEN defines the size of buffer used to grab environment variables
- X+ (amongst other things) in js, and to place them in the table
- X+ in qp. Set it to at least 1 greater than the maximum environment
- X+ string length (including the environment name and the '=').
- X+ Also used for reading the input file in js, so it must also be
- X+ larger than the largest input line.
- X+
- X+ QMAXENV defines the size of the environment table passed to the running
- X+ job by qp. Set it to at least 4 greater than the maximum
- X+ number of environment variables to be passed (3 used by QBATCH
- X+ and a trailing NULL pointer).
- X+
- X+ Also found envvar writing all over everywhere when transferring large (>255 char)
- X+ environment variables to the table, changed envvar to a char * pointing into buff1.
- X+
- X+ Minor cosmetic changes to qf (-s) option .. not reporting current job if it is
- X+ the first one since the queue started.
- X+
- X+ 14 November 1991
- X+
- X+ Cosmetic change in logging.c.. no need for end time since:
- X+
- X+ end time = start time + ((queued + real)/100)
- X+
- X+ so first two fields are now start date and time in a more human readable form
- X+ (yyyymm/dd:HH.MM.SS)
- X+
- X+ For anyone who hasn't worked it out :-), user response time (the time between
- X+ submitting a job, and the job's completion) is:
- X+
- X+ response time = end time - start time
- Index: doc/Index
- X***************
- X*** 18,23 ****
- X--- 18,24 ----
- X chap.04 USER Commands anyone can use.
- X
- X chap.05 MONITORS What they are, and how to configure and use them.
- X+ LOGGING Maintain timings on a per job per queue basis.
- X
- X chap.06 CONFIGURATION What needs to be done to install a working QBATCH.
- X
- Index: doc/chap.04
- X***************
- X*** 201,206 ****
- X--- 201,232 ----
- X Column 7 is the job name, which, if used, gives some indication
- X of the job running.
- X
- X+ JOB Names: These are extremely useful if used regularly, particularly
- X+ on a heavily used system. They allow the user to see at a glance just
- X+ exactly what is running, and perhaps make a fair guess (assuming he or
- X+ she knows how long the types of job take), at how long it will be before
- X+ their job will be complete.
- X+
- X+ The usual source of a job name is with the -n option to js, but there
- X+ are other options.
- X+
- X+ During the life of say a development project, an environment variable
- X+ JOBNAME=<namestring> will cause js to use <namestring> if the job name
- X+ is not specified with the -n option.
- X+
- X+ For regularly run jobs submitted as an existing file of jcl, a comment
- X+ line:
- X+ #JOBNAME=<namestring>
- X+ will cause js to use <namestring> in the absence of any other name.
- X+
- X+ In the absence of any other job name specification, js will use the
- X+ LAST line of the jcl submitted to it (or at least the first 30 chars)
- X+ as the job name. In the case of a single command (-c option), it will
- X+ be the command line.
- X+
- X+ To add a missing job name to a queue entry, or change an existing one,
- X+ use 'js'.
- X+
- X qf Queue find.
- X qt Queue test. These programs are primarily provided for use in shell
- X scripts. All of the options of qf provide output on stdout relating to
- Index: doc/chap.05
- X***************
- X*** 164,171 ****
- 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--- 164,172 ----
- X
- X As released, the data logged is:
- X
- X+ start date of job (yyyy/mm/dd)
- X+ start time of job (HH.MM.SS)
- X start time of job (time_t format)
- X user name
- X uid
- X gid
- X***************
- X*** 179,181 ****
- X--- 180,195 ----
- X
- X fields in the record are packed (no spaces) with a colon (':') as a
- X field delimiter.
- X+
- X+ Example: (tail -10 `qf -L work`)
- X+
- X+ 1991/11/14:11.00.58:690116458:root:0:1:"make qbatch":100:18020:9433:6611
- X+ 1991/11/14:11.04.47:690116687:sop:200:200:"Sales Analysis":0:7218:3690:2666
- X+ 1991/11/14:11.06.00:690116760:sop:200:200:"Outstanding Orders":3800:4516:2291:1635
- X+ 1991/11/14:11.06.50:690116810:sop:200:200:"Invoice Print":0:3018:1520:1101
- X+ 1991/11/14:11.08.15:690116895:accounts:71:71:"Account Print":0:2016:1035:731
- X+ 1991/11/14:11.09.16:690116956:payroll:99:2006:"Pay Analysis":0:5425:2643:1920
- X+ 1991/11/14:11.10.11:690117011:root:0:1:"make install":1900:2516:1253:905
- X+ 1991/11/14:11.11.09:690117069:payroll:99:2006:"Payslips":0:4820:2441:1755
- X+ 1991/11/14:11.11.57:690117117:sop:200:200:"Order Acknowledgements":900:9721:4998:3550
- X+ 1991/11/14:11.13.35:690117215:accounts:71:71:"Statements Print":5000:17318:8870:6373
- Index: doc/chap.07
- X***************
- X*** 67,75 ****
- X User: The user cpu time taken by the job.
- X System: The system cpu time taken by the job.
- X
- X Ideally, if a system is correctly tuned, the average timings of a given
- X queue should only vary within limits. Any wider variance is a reason to
- X! look at the individual times in the monitors.
- X
- X Consistently low utilisation would probably indicate that jobs
- X submitted to this queue could probably share resources better by being
- X--- 67,86 ----
- X User: The user cpu time taken by the job.
- X System: The system cpu time taken by the job.
- X
- X+ For more long term monitoring of queue activity, there is the logging
- X+ option. If LOGGING is defined in qbatch.h when the system is compiled,
- X+ and if logging is switched on for a given queue with 'qc -l <queuename>'
- X+ then a log record is written to the log for every job processed. (see
- X+ chap.05 section 5a for details). The data logged is defined in logging.c
- X+ and may be tuned to suit the system administrator. As released, the
- X+ log record is designed more for analysis by a program than to be humanly
- X+ readable. Where a QBATCH system is implemented to use distributed
- X+ monitors (either personal monitors, or mailed monitors) then logging is
- X+ perhaps the only way to monitor queue performance.
- X+
- X Ideally, if a system is correctly tuned, the average timings of a given
- X queue should only vary within limits. Any wider variance is a reason to
- X! look at the individual times in the monitors or logs.
- X
- X Consistently low utilisation would probably indicate that jobs
- X submitted to this queue could probably share resources better by being
- Index: src/Makefile
- X***************
- X*** 30,35 ****
- X--- 30,45 ----
- X
- X SUBJECT="-s"
- X
- X+ # Buffer length (particularly for getting and setting environment variables)
- X+ # (js broke on some systems 'cos the original size wasn't enough)
- X+
- X+ QBUFLEN=1024
- X+
- X+ # Maximum number of environment variables passed in the environment table to the
- X+ # running job (apparently 45 is not enough in some cases)
- X+
- X+ QMAXENV=100
- 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*** 42,50 ****
- 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--- 52,63 ----
- X
- X CFLAG=-g
- X LDFLAG=-Bstatic
- X+
- X QPATHS=-DQUEUEPATH=\"$(QUEUEPATH)\" -DSPOOLPATH=\"$(SPOOLPATH)\" \
- X! -DBINDIR=\"$(BINDIR)\" -DMAILPATH=\"$(MAILPATH)\"
- X
- X+ QDEFINES=-DSUBJECT=\"$(SUBJECT)\" -DQBUFLEN=$(QBUFLEN) -DQMAXENV=$(QMAXENV)
- 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***************
- X*** 51,77 ****
- X @echo "\n\007programs and scripts ... make complete\n"
- X
- X jj: jj.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jk: jk.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jm: jm.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jn: jn.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jr: jr.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X js: js.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X qa: qagen Makefile
- X--- 64,90 ----
- X @echo "\n\007programs and scripts ... make complete\n"
- X
- X jj: jj.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jk: jk.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jm: jm.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jn: jn.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jr: jr.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X js: js.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X qa: qagen Makefile
- X***************
- X*** 79,126 ****
- X chmod 0755 $@
- X
- X qc: qc.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qd: qd.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qe: qe.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qf: qf.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c -o $@
- X chmod 0711 $@
- X
- X qg: qg.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qh: qh.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X ql: ql.c qbatch.h
- 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! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qt: qt.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c -o $@
- X chmod 06711 $@
- X
- X qw: qw.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o -o $@
- X chmod 0711 $@
- X
- X jobdone: jdgen Makefile
- X--- 92,139 ----
- X chmod 0755 $@
- X
- X qc: qc.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qd: qd.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qe: qe.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qf: qf.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 0711 $@
- X
- X qg: qg.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qh: qh.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X ql: ql.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 0711 $@
- X
- X qp: qp.c qbatch.h config.o time.o logging.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o time.o \
- X logging.o -o $@
- X chmod 0700 $@
- X
- X qs: qs.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qt: qt.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 06711 $@
- X
- X qw: qw.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0711 $@
- X
- X jobdone: jdgen Makefile
- X***************
- X*** 132,144 ****
- X chmod 0700 rc.QBATCH
- X
- 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--- 145,157 ----
- X chmod 0700 rc.QBATCH
- X
- X config.o: config.c config.h qbatch.h
- X! cc $(CFLAG) $(QPATHS) $(QDEFINES) -c config.c
- X
- X time.o: time.c config.h
- X! cc $(CFLAG) $(QPATHS) $(QDEFINES) -c time.c
- X
- X logging.o: logging.c config.h
- X! cc $(CFLAG) $(QPATHS) $(QDEFINES) -c logging.c
- X
- X qbatch.h: what.h Makefile
- X touch qbatch.h
- Index: src/config.c
- X***************
- X*** 134,140 ****
- X int fd;
- X /* check if the file is locked, return 0 if not locked, non 0 if locked */
- X {
- X! return (flock(fd, LOCK_EX|LOCK_NB);
- X }
- X #endif /* FLOCK */
- X
- X--- 134,140 ----
- X int fd;
- X /* check if the file is locked, return 0 if not locked, non 0 if locked */
- X {
- X! return (flock(fd, LOCK_EX|LOCK_NB));
- X }
- X #endif /* FLOCK */
- X
- X***************
- X*** 238,244 ****
- X int sig;
- X {
- X struct sigvec actsig;
- X! actsig.sv_mask) = 0
- X actsig.sv_flags = 0;
- X actsig.sv_handler = (HANDLER_TYPE (*)())sig;
- X sigvec(sig, actsig, (struct sigvec *) NULL);
- X--- 238,244 ----
- X int sig;
- X {
- X struct sigvec actsig;
- X! actsig.sv_mask = 0;
- X actsig.sv_flags = 0;
- X actsig.sv_handler = (HANDLER_TYPE (*)())sig;
- X sigvec(sig, actsig, (struct sigvec *) NULL);
- Index: src/config.h
- X***************
- X*** 79,92 ****
- X /* above.) The variable 'had_usersig' is set in the handler so that pause */
- X /* and wait routines can check if the handler needs to be re-installed. */
- X
- X! /*#define SIGACTION*/ /* XPG3 */
- X! #define SIGSET
- X /*#define SIGVEC */
- X /*#define SIGNAL */
- X /* the type of the handler function can vary from system to system. it is */
- X /* usually either void or int */
- X! /*typedef void HANDLER_TYPE;*/
- X! typedef int HANDLER_TYPE;
- X
- X /*---------------------------------------------------------------------------*/
- X /* wait calls (define one of these) */
- X--- 79,92 ----
- X /* above.) The variable 'had_usersig' is set in the handler so that pause */
- X /* and wait routines can check if the handler needs to be re-installed. */
- X
- X! #define SIGACTION /* XPG3 */
- X! /* #define SIGSET */
- X /*#define SIGVEC */
- X /*#define SIGNAL */
- X /* the type of the handler function can vary from system to system. it is */
- X /* usually either void or int */
- X! typedef void HANDLER_TYPE;
- X! /* typedef int HANDLER_TYPE; */
- X
- X /*---------------------------------------------------------------------------*/
- X /* wait calls (define one of these) */
- Index: src/js.c
- X***************
- X*** 34,40 ****
- X char *queuename;
- X char jclfile[128];
- X char queue[128];
- X! char buff [256];
- X char rcmd [128];
- X struct envlist {
- X char *envptr;
- X--- 34,40 ----
- X char *queuename;
- X char jclfile[128];
- X char queue[128];
- X! char buff [QBUFLEN];
- X char rcmd [128];
- X struct envlist {
- X char *envptr;
- X***************
- X*** 203,209 ****
- X {
- X if (*monitor != '/') /* monitor should be full pathspec */
- X { /* so add current working directory */
- X! getcwd (buff, 128);
- X if (buff [strlen(buff) - 1] != '/') strcat (buff, "/");
- X strcat (buff, monitor);
- X strcpy (monitor, buff);
- X--- 203,209 ----
- X {
- X if (*monitor != '/') /* monitor should be full pathspec */
- X { /* so add current working directory */
- X! getcwd (buff, QBUFLEN);
- X if (buff [strlen(buff) - 1] != '/') strcat (buff, "/");
- X strcat (buff, monitor);
- X strcpy (monitor, buff);
- X***************
- X*** 279,285 ****
- X if (fpin != NULL)
- X {
- X /* set up exclude environment table */
- X! while (fgets(buff, 256, fpin) != NULL)
- X {
- X if (buff[0] == '#') continue;
- X if (buff[0] == ' ') continue;
- X--- 279,285 ----
- X if (fpin != NULL)
- X {
- X /* set up exclude environment table */
- X! while (fgets(buff, QBUFLEN, fpin) != NULL)
- X {
- X if (buff[0] == '#') continue;
- X if (buff[0] == ' ') continue;
- X***************
- X*** 290,296 ****
- X }
- X for (i=0; envp[i] != NULL; i++)
- X {
- X! strcpy (buff, envp[i]);
- X for (j = 0; buff[j] != '='; j++){}
- X buff[j] = 0;
- X if (scan_envlist(root, buff) <= 0)
- X--- 290,299 ----
- X }
- X for (i=0; envp[i] != NULL; i++)
- X {
- X! for (j = 0; ((j < (QBUFLEN - 1)) && (envp[i][j] != 0)); j++)
- X! buff[j] = envp[i][j];
- X! buff[j] = 0;
- X! /* strcpy (buff, envp[i]); (overwriting data) */
- X for (j = 0; buff[j] != '='; j++){}
- X buff[j] = 0;
- X if (scan_envlist(root, buff) <= 0)
- X***************
- X*** 330,340 ****
- X unlink (jclfile);
- X exit (-1);
- X }
- X! fgets (buff, 128, fpin);
- X if ((*buff == '#') && (buff[1] == '!') && (buff[2] == '/'))
- X {
- X fprintf (fpout, "%s", buff);
- X! fgets (buff, 128, fpin);
- X }
- X else
- X {
- X--- 333,343 ----
- X unlink (jclfile);
- X exit (-1);
- X }
- X! fgets (buff, QBUFLEN, fpin);
- X if ((*buff == '#') && (buff[1] == '!') && (buff[2] == '/'))
- X {
- X fprintf (fpout, "%s", buff);
- X! fgets (buff, QBUFLEN, fpin);
- X }
- X else
- X {
- X***************
- X*** 413,419 ****
- X }
- X if (fixedcontext == 0) fputs (buff, fpout);
- X *buff = 0;
- X! fgets (buff, 128, fpin);
- X }
- X if ((permission == 0) && (jobuid != 0) && (jobuid != saveuid))
- X {
- X--- 416,422 ----
- X }
- X if (fixedcontext == 0) fputs (buff, fpout);
- X *buff = 0;
- X! fgets (buff, QBUFLEN, fpin);
- X }
- X if ((permission == 0) && (jobuid != 0) && (jobuid != saveuid))
- X {
- X***************
- X*** 478,484 ****
- X }
- X else
- X {
- X! while (fgets (buff, 128, fpin) != NULL)
- X {
- X fputs (buff, fpout);
- X if (*jobname == 0)
- X--- 481,487 ----
- X }
- X else
- X {
- X! while (fgets (buff, QBUFLEN, fpin) != NULL)
- X {
- X fputs (buff, fpout);
- X if (*jobname == 0)
- X***************
- X*** 490,496 ****
- X {
- X *fcptr = 0;
- X fcptr ++;
- X! if (strcmp (buff, "JOBNAME") == 0)
- X strcpy (jobname, fcptr);
- X }
- X }
- X--- 493,499 ----
- X {
- X *fcptr = 0;
- X fcptr ++;
- X! if (strcmp (buff, "#JOBNAME") == 0)
- X strcpy (jobname, fcptr);
- X }
- X }
- Index: src/logging.c
- X***************
- X*** 15,20 ****
- X--- 15,21 ----
- X
- X #include <stdio.h>
- X #include "qbatch.h"
- X+ #include <time.h>
- X #ifdef LOGGING
- X
- X FILE *log;
- X***************
- X*** 24,29 ****
- X--- 25,31 ----
- X extern time_t end_time;
- X extern char *queuename;
- X char buff[128];
- X+ struct tm *work_time;
- X void q_log()
- X {
- X /* first let's see if we're logging */
- X***************
- X*** 42,54 ****
- X }
- X /* here you can add what you like to the log. I've chosen to put out */
- X /* numbers as decimal representations of their internal forms for */
- X! /* easier computer analysis rather than in human readable form such */
- X! /* as converting dates and times etc. */
- X fprintf (log, "%lu:", ehead->qh_start); /* start time of job (time_t)*/
- X- fprintf (log, "%lu:", end_time); /* end time of job (time_t)*/
- X fprintf (log, "%s:",eentry->qe_uname); /* user name */
- X fprintf (log, "%d:", eentry->qe_uid); /* uid */
- X fprintf (log, "%d:", eentry->qe_gid); /* gid */
- X fprintf (log, "%lu:", q_queued); /* process times are in 1/100*/
- X fprintf (log, "%lu:", q_real); /* seconds (subject to the */
- X fprintf (log, "%lu:", q_user); /* accuuracy of the clock. */
- X--- 44,59 ----
- X }
- X /* here you can add what you like to the log. I've chosen to put out */
- X /* numbers as decimal representations of their internal forms for */
- X! /* easier computer analysis. */
- X!
- X! work_time = localtime (&ehead->qh_start);
- X! strftime (buff, 24, "%Y/%m/%d:%H.%M.%S", work_time); /* readable */
- X! fprintf (log, "%s:", buff); /* start date and start time of job */
- X fprintf (log, "%lu:", ehead->qh_start); /* start time of job (time_t)*/
- X fprintf (log, "%s:",eentry->qe_uname); /* user name */
- X fprintf (log, "%d:", eentry->qe_uid); /* uid */
- X fprintf (log, "%d:", eentry->qe_gid); /* gid */
- X+ fprintf (log, "\"%s\":", eentry->qe_jobname); /* job name */
- X fprintf (log, "%lu:", q_queued); /* process times are in 1/100*/
- X fprintf (log, "%lu:", q_real); /* seconds (subject to the */
- X fprintf (log, "%lu:", q_user); /* accuuracy of the clock. */
- Index: src/qf.c
- X***************
- X*** 231,255 ****
- X now *= 100;
- X printf ("\n Available for : %s\n" ,print_time (now, 1));
- X }
- X! if (head.qh_jobcount == 0)
- X {
- X! printf("No jobs run since queue started\n");
- X! exit(0);
- X! }
- X! printf (" No. Jobs Processed: %d\n\n", head.qh_jobcount);
- X! printf ("Times:\t\t Actual\t\t\tAv. Per Job\n\n");
- X! printf ("Queued\t\t%16s", print_time(head.qh_queued, 0));
- X! printf (" %16s\n", print_time(head.qh_queued/head.qh_jobcount, 0));
- X! printf ("Real\t\t%16s", print_time(head.qh_real, 0));
- X! printf (" %16s\n", print_time(head.qh_real/head.qh_jobcount, 0));
- X! printf ("User\t\t%16s", print_time(head.qh_user, 0));
- X! printf (" %16s\n", print_time(head.qh_user/head.qh_jobcount, 0));
- X! printf ("System\t\t%16s", print_time(head.qh_system, 0));
- X! printf (" %16s\n", print_time(head.qh_system/head.qh_jobcount, 0));
- X! if (head.qh_pid == 0) exit(0);
- X! head.qh_real *= 10000;
- X! head.qh_real /= now ;
- X! printf("\nUtilisation (real/available) %d.%02d%%\n",(head.qh_real/100), (head.qh_real%100));
- X if (head.qh_start)
- X {
- X then -= head.qh_start;
- X--- 231,254 ----
- X now *= 100;
- X printf ("\n Available for : %s\n" ,print_time (now, 1));
- X }
- X! if (head.qh_jobcount != 0)
- X {
- X! printf (" No. Jobs Processed: %d\n\n", head.qh_jobcount);
- X! printf ("Times:\t\t Actual\t\t\tAv. Per Job\n\n");
- X! printf ("Queued\t\t%16s", print_time(head.qh_queued, 0));
- X! printf (" %16s\n", print_time(head.qh_queued/head.qh_jobcount, 0));
- X! printf ("Real\t\t%16s", print_time(head.qh_real, 0));
- X! printf (" %16s\n", print_time(head.qh_real/head.qh_jobcount, 0));
- X! printf ("User\t\t%16s", print_time(head.qh_user, 0));
- X! printf (" %16s\n", print_time(head.qh_user/head.qh_jobcount, 0));
- X! printf ("System\t\t%16s", print_time(head.qh_system, 0));
- X! printf (" %16s\n", print_time(head.qh_system/head.qh_jobcount, 0));
- X! if (head.qh_pid == 0) exit(0);
- X! head.qh_real *= 10000;
- X! head.qh_real /= now ;
- X! printf("\nUtilisation (real/available) %d.%02d%%\n",(head.qh_real/100), (head.qh_real%100));
- X! }
- X! else printf("\nNo jobs completed since queue started\n");
- X if (head.qh_start)
- X {
- X then -= head.qh_start;
- Index: src/qp.c
- X***************
- X*** 11,16 ****
- X--- 11,17 ----
- X
- X #include "qbatch.h"
- X #include <malloc.h>
- X+ #include <ctype.h>
- X
- X /* pointers to qp's structures for external use (in logging.c) */
- X struct queue_header * ehead = &head;
- X***************
- X*** 27,33 ****
- 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--- 28,34 ----
- X struct tm *jtimes;
- X time_t end_time;
- X char exit_message[64];
- X! char envflg[5], * envvar;
- X char temp[128],
- X *jcl,
- X *jcwd = NULL;
- X***************
- X*** 41,53 ****
- X extern pid_t childid;
- X char queue[128];
- X char buff[128];
- X! char buff1[255];
- X char path[128];
- X char qbc[10];
- X unsigned long q_queued, q_real, q_user, q_system;
- X char qentry[12];
- X char *args[10],
- X! *envs[50],
- X *queuename;
- X
- X char * print_time(val)
- X--- 42,54 ----
- X extern pid_t childid;
- X char queue[128];
- X char buff[128];
- X! char buff1[QBUFLEN];
- X char path[128];
- X char qbc[10];
- X unsigned long q_queued, q_real, q_user, q_system;
- X char qentry[12];
- X char *args[10],
- X! *envs[QMAXENV],
- X *queuename;
- X
- X char * print_time(val)
- X***************
- X*** 407,422 ****
- X args[j] = (char *) NULL;
- X strcpy (queue, "QUEUE=");
- X strcat (queue, queuename);
- X! for (j=0; j< 50; j++) envs[j] = (char *) NULL;
- X j = 0;
- X! while (1) /* transfer environment variables (up to 46) */
- X {
- X! fgets (buff1, 255, fpin);
- X! sscanf (buff1, "%s %s", envflg, envvar);
- X if (strcmp (envflg, "#ENV")) break; /* no more */
- X! envs [j] = malloc(strlen(envvar)+1);
- X strcpy (envs[j++], envvar);
- X! if (j > 45) break; /* can't fit any more in table */
- X }
- X fclose (fpin);
- X envs[j++] = queue;
- X--- 408,428 ----
- X args[j] = (char *) NULL;
- X strcpy (queue, "QUEUE=");
- X strcat (queue, queuename);
- X! for (j=0; j< QMAXENV; j++) envs[j] = (char *) NULL;
- X j = 0;
- X! while (1) /* transfer environment variables (up to (QMAXENV-5)) */
- X {
- X! fgets (buff1, QBUFLEN, fpin);
- X! for (i = 0; i <4; i++) envflg[i] = buff1[i];
- X! envflg[i] = 0;
- X if (strcmp (envflg, "#ENV")) break; /* no more */
- X! for (i = 4; isspace(buff1[i]); i++){};
- X! envvar = &buff1[i];
- X! i = strlen(envvar);
- X! if (envvar[i-1] == '\n') envvar[i-1] = 0;
- X! envs [j] = malloc(i);
- X strcpy (envs[j++], envvar);
- X! if (j > (QMAXENV - 5)) break; /* can't fit any more in table */
- X }
- X fclose (fpin);
- X envs[j++] = queue;
- END_OF_FILE
- if test 28288 -ne `wc -c <'patches/qbatch.p2'`; then
- echo shar: \"'patches/qbatch.p2'\" unpacked with wrong size!
- fi
- # end of 'patches/qbatch.p2'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- 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.
-