home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume25
/
QBATCH
/
patch01a
< prev
next >
Wrap
Text File
|
1991-11-12
|
14KB
|
385 lines
Newsgroups: comp.sources.misc
From: alan@tharr.uucp (Alan Saunders)
Subject: v25i058: QBATCH - a queued batch processing system for UNIX, Patch01a/2
Message-ID: <csm-v25i058=QBATCH.220540@sparky.IMD.Sterling.COM>
X-Md4-Signature: d71c384fc88825c176f6e680b02bea48
Date: Wed, 13 Nov 1991 04:06:55 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: alan@tharr.uucp (Alan Saunders)
Posting-number: Volume 25, Issue 58
Archive-name: QBATCH/patch01a
Environment: UNIX
Patch-To: QBATCH: Volume 25, Issue 20-25
This patch fixes several typos an bugs in ifdef'd code not defined on my
system:
: missing semicolons in config.h and config.c
: setuser() should be qb_setuser() in config.c
: toggle_halt_status() now ifdef'd on signal definitions
for those systems which don't define SIGHALT and SIGCONT
: added install target for qt
: Monitor files now created with correct ownership and access rights.
: removed hardwired path for jobdone script in qp.c
ADDITIONS:
: added quickstart document at the request of Ian Lea (Siemens) who
also pointed out most of the above.
***
************************************************************************
*** Personal note to Ian Lea ... The email address you gave me bounced!!!
************************************************************************
***
: Added the ability to mail monitors to the submitting user at
the request of Peter Da Silva. (peter@ficc.ferranti.com)
: Added ability to log profile timings in a queue logfile as well
as in the monitors to allow monitoring/ accounting of queue
throughput when monitors are dispersed (mailed and personal monitors)
This patch consists of a patch file (patches.qbatch.p1) and two new files
(doc/quickstart, and src/logging.c)
Additional details may be found in the modified NEWS file, and documentation
updates.
Change directory to the QBATCH root directory (where you originally unpacked
the QBATCH shar files) and similarly unpack all files in this shar archive.
When you have unpacked the archives run patch as follows:
patch -p0 <patches/qbatch.p1
which will bring all files in the qbatch tree up to date.
Change any configration requirements, and make as before.
I must apologise for the bugs which crept in, and thank all those providing
feedback, keep it coming.
I would like to know the following if you got QBATCH working or intend to do
so:
The system (machine and os) to which you have ported it.
Any problems, you encountered.
Any changes you made to get it to work.
Any comments (preferrably constructive) about QBATCH.
Anything I've left out which you'd like to see implemented.
If you get QBATCH working with changes only to config.h, i'd like you to send
a config.<arch> file containing the definitions used on your architecture,
which can be included with future releases to ease the way for new users.
Regards .. and thanks .. Alan
-----------------------------
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# 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: . ./doc ./doc/quickstart ./patches ./src ./src/logging.c
# 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 1 (of 2)."'
if test ! -d './doc' ; then
echo shar: Creating directory \"'./doc'\"
mkdir './doc'
fi
if test -f './doc/quickstart' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./doc/quickstart'\"
else
echo shar: Extracting \"'./doc/quickstart'\" \(5767 characters\)
sed "s/^X//" >'./doc/quickstart' <<'END_OF_FILE'
X
X
X QBATCH a queued batch processing system for UNIX
X
X
X The QBATCH system and its related programs were
X written by Alan D. Saunders and are
X Copyright (c) Vita Services Ltd. 1990 and
X Copyright (c) Vita Fibres Ltd. 1991
X
XFor those who don't want to read all the documentation before trying out QBATCH,
Xhere is a no frills introduction.
X
XFirst, the admin work.
X As sysadmin (root) (if you're not, get your sysadmin to do this)
X
X 1. Ensure that the QBATCH programs are correctly compiled and installed.
X
X 2. Ensure that QUEUEPATH, and SPOOLPATH as defined in the makefile
X exist and are accessible.
X
X 1. Create some queues, a good start is fast, slow, norm.
X qc -n -10 fast
X qc -n 10 slow
X qc norm
X
X 3. Start a process engine for each queue.
X qp fast
X qp slow
X qp norm
X
X The super user can kill a process engine when it is idle with:
X qs fast
X (or slow, or norm)
X
X If a job is actually processing when the qs program is run, then qp
X will wait until the job has finished or is killed before terminating.
X
XNow you can play! Log in as an ordinary user and start by creating a test
X script (one that doesn't really do anything) such as
X id
X sleep 10
X env
X find / -name xyzzy -print
X
X It should take some time to process, but won't do any damage!
X
X and try:
X js -n test fast <name of test script>
X
X This submits a job to the fast queue which will run your script.
X
X Check the queue contents with:
X ql fast
X
X If you try:
X ql norm
X or
X ql slow
X You will see empty queues.
X
X Wait until the job has finished and try:
X more `qf -m fast`
X
X To examine the monitor (output) of the job.
X
X Try submitting the job to the queue several times in succession, perhaps
X using the -r option to tell you when it has finished:
X js -n test -r1 fast <testfile>
X js -n test -r2 fast <testfile>
X js -n test -r1 fast <testfile>
X js -n test -r2 fast <testfile>
X js -n test -r1 fast <testfile>
X js -n test -r2 fast <testfile>
X js -n test -r1 fast <testfile>
X js -n test -r2 fast <testfile>
X
X Then list the queue again with:
X ql fast
X
X Notice each entry has an entry number in the first column.
X This can be used to remove jobs from the queue:
X jk -e<number> fast
X
X Try it out, try it also on the running job (the one with the number in the
X second column). ... Didn't work did it?
X To remove the running job, the kill option must be specified to jk:
X jk -k -e<number> fast
X
X Neither of these options will work if you did not submit the job you are
X trying to remove, and you're not logged in as superuser.
X
X You will notice that the reply option will only work if the job has
X actually been processed in some way. A job that is removed from the queue
X before reaching the top will not give a reply.
X
X If you need to get rid of all (your) jobs in the queue, try:
X jk -k -a fast
X
X The -a is the ALL option.
X
X Submit another group of jobs to the queue, and get another user, logged in
X under a different id to submit a group, then submit a few more yourself.
X Try changing the order of jobs in the queue with:
X jj -e<entry number> fast
X
X You can change the order of a consecutive group of your own jobs, by moving
X selected entries to the top of the group, but you can't (unless you are
X logged in as super user) move a job above someone else's.
X
X You can direct the monitor (output) of a job to a place of your own
X choosing either:
X js -n test -m <pathspec> fast <testfile>
X
X or set an environment variable to a pathspec:
X (sh)
X MONITOR=<pathspec>
X export MONITOR
X (or csh)
X setenv MONITOR <pathspec>
X
X before submitting the job.
X In both cases, if the pathspec refers to a file, then that will be used as
X a monitor. If it refers to a directory, then in this case (if the queue is
X 'fast') a file <pathspec>/fast.mon will be used.
X
X NOTE If the monitor is redirected in this way, then using `qf -m fast`
X will return either the monitor spec of the running job, or the queue
X default monitor spec, rather than your personal monitor.
X
X If you specify a monitor of "MAIL", either through the js -m option, or
X through your environment, the monitor of the job will be mailed to you.
X
X This should be enough to get you started and playing with QBATCH, apart
X from a few brief notes on how to get jobs into queues:
X
X a. As described above, create a file of jcl and submit it:
X js fast <jobfile>
X
X b. As a 'here document'
X js fast <<here
X command
X [..]
X here
X
X This is useful when a non-standard job needing more than one command is
X required, an alternative giving the same functionality is:
X js fast
X command
X [..]
X ^D
X
X c. For a single self contained command (e.g. make install) try
X js -c "make install" fast
X
X d. For regularly run jobs, try renaming the command (e.g make -> MAKE)
X and create a script with the original name, and containing either of
X the above (a or c) calls to js, but calling (e.g.) MAKE.
X
X e. For jobs run regularly with varying parameters, create a script which
X creates a job file using substitution paramters ($1, $2 etc), and
X submits it.
X
X f. If you have a script which outputs shell script (perl, sed, etc) which
X you would normally pipe to the shell, try piping it to js instead:
X <scriptcommand> | js fast
X
X or:
X perl <file.pl> | js fast
X
X This document is NOT meant to be a user manual! It is designed to get you
X working with the basics of QBATCH as quickly as possible. Once you have
X mastered (or at least become competent with) the commands discussed here,
X then RTFM :-) (to quote a commonly used cliche).
X
X Alan
END_OF_FILE
if test 5767 -ne `wc -c <'./doc/quickstart'`; then
echo shar: \"'./doc/quickstart'\" unpacked with wrong size!
fi
# end of './doc/quickstart'
fi
if test ! -d './patches' ; then
echo shar: Creating directory \"'./patches'\"
mkdir './patches'
fi
if test ! -d './src' ; then
echo shar: Creating directory \"'./src'\"
mkdir './src'
fi
if test -f './src/logging.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./src/logging.c'\"
else
echo shar: Extracting \"'./src/logging.c'\" \(2735 characters\)
sed "s/^X//" >'./src/logging.c' <<'END_OF_FILE'
X/****************************************************************************/
X/* */
X/* This file is provided to give a sysop the means to monitor queue */
X/* activity, and throughput when the monitors from jobs may be widely */
X/* spread (private monitors or mailed monitors). Called as a function from */
X/* qp (if LOGGING is defined in qbatch.h) it has access to all the global */
X/* variables in that program. The contents of the log file may not suit */
X/* the requirements of all system administrators, which is why this is in */
X/* a separate file, so that it can be modified to suit. The general idea */
X/* is to provide all available (or required) information relating to jobs */
X/* processed in a queue, in a single line format, suitable perhaps for */
X/* automatic analysis. */
X/* */
X/****************************************************************************/
X
X#include <stdio.h>
X#include "qbatch.h"
X#ifdef LOGGING
X
XFILE *log;
Xextern struct queue_header * ehead;
Xextern struct queue_entry * eentry;
Xextern unsigned long q_queued, q_real, q_user, q_system;
Xextern time_t end_time;
Xextern char *queuename;
Xchar buff[128];
Xvoid q_log()
X{
X /* first let's see if we're logging */
X if ((ehead->qh_flags & qh_log) == 0) return;
X /* set up logfile path as SPOOLPATH/<queuename>.log */
X strcpy (buff, head.qh_spool);
X if (buff[strlen(buff) -1] != '/') strcat (buff, "/");
X strcat (buff, queuename);
X strcat (buff, ".log");
X log = fopen (buff, "a");
X if (log == NULL)
X {
X /* shouldn't happen, we're running as root remember? */
X fprintf (stderr, "unable to access %s .. aborting\n", buff);
X qb_exit (-1);
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 fprintf (log, "%lu\n", q_system);
X fclose (log);
X return;
X}
X#endif /* LOGGING */
END_OF_FILE
if test 2735 -ne `wc -c <'./src/logging.c'`; then
echo shar: \"'./src/logging.c'\" unpacked with wrong size!
fi
# end of './src/logging.c'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
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.