System V -- /usr/lib/cron/.proto and batch

Mike Wescott wescott at ncrcae.Columbia.NCR.COM
Wed Jun 21 00:11:04 AEST 1989


In articles <255 at chip.UUCP> and <256 at chip.UUCP> mparker at chip.UUCP (M. D. Parker) writes:

> The MAN page for BATCH(1) and AT(1) lists information about both commands
> together.  The man page indicates that invoking the BATCH command will 
> wait to start a job "until system load permits".  

> Exactly what does this mean?  

This man page for /usr/lib/cron/queuedefs posted some time ago by Guy Harris
should answer that, a shar of it is at the end of the message.

> In observing the operation of 'at', I have noticed that it places information
> from the /usr/lib/cron/.proto file at the head of the job.  I would 
> be interested in knowing what variables are passed for integration into
> this file.  From what I see, there is $d for local directory, and $l for
> limit.  How many other such variables are provided?  What are their names
> and functions?

At(1) reads .proto and recognizes the following commands:

	$d - substitute current working directory
	$l - substitute ulimit
	$m - substitute umask
	$t - substitute time to run script (preceded by a colon)
		time is in decimal (seconds since the epoch)
	$< - read in at job (from stdin) with no subs performed


# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# queuedefs.4 queuedefs.4.nr

echo x - queuedefs.4
cat > "queuedefs.4" << '//E*O*F queuedefs.4//'
.TH QUEUEDEFS 4
.SH NAME
queuedefs \- at/batch/cron queue description file
.SH SYNOPSIS
.LP
.B /usr/lib/cron/queuedefs
.SH DESCRIPTION
The
.I queuedefs\^
file describes the characteristics of the queues managed by
.IR cron (1M).
Each non-comment line in this file describes one queue.
The format of the lines are as follows:
.RS
.LP
\f2q\f3.\f1[\f2njob\f3j\f1][\f2nice\f3n\f1][\f2nwait\f3w\f1]
.RE
.LP
The fields in this line are:
.RS
.TP
.I q\^
The name of the queue.
.B a
is the default queue for jobs started by
.IR at (1);
.B b
is the default queue for jobs started by
.IR batch (1);
.B c
is the default queue for jobs run from a
.B crontab
file.
.TP
.I njob\^
The maximum number of jobs that can be run simultaneously in that queue; if
more than
.I njob\^
jobs are ready to run, only the first
.I njob\^
jobs will be run, and the others will be run as jobs that are currently running
terminate.  The default value is 100.
.TP
.I nice\^
The
.IR nice (1)
value to give to all jobs in that queue that are not run with a user
.SM ID
of super-user.  The default value is 2.
.TP
.I nwait\^
The number of seconds to wait before rescheduling a job that was deferred
because more than
.I njob\^
jobs were running in that job's queue, or because more than 25 jobs were
running in all the queues.  The default value is 60.
.RE
.LP
Lines beginning with
.B #
are comments, and are ignored.
.SH EXAMPLE
.RS
.nf
.ft B
a.4j1n
b.2j2n90w
.RE
.fi
.ft R
.LP
This file specifies that the
.B a
queue, for
.I at\^
jobs, can have up to 4 jobs running simultaneously; those jobs will be run with
a
.I nice\^
value of 1.  As no
.I nwait\^
value was given, if a job cannot be run because too many other jobs are running
.I cron\^
will wait 60 seconds before trying again to run it.
The
.B b
queue, for
.I batch\^
jobs, can have up to 2 jobs running simultaneously; those jobs will be run with
a
.I nice\^
value of 2.  If a job cannot be run because too many other jobs are running,
.I cron\^
will wait 90 seconds before trying again to run it.
All other queues can have up to 100 jobs running simultaneously; they will be
run with a
.I nice\^
value of 2, and if a job cannot be run because too many other jobs are running
.I cron\^
will wait 60 seconds before trying again to run it.
.SH FILES
/usr/lib/cron/queuedefs
.SH "SEE ALSO"
cron(1M)
//E*O*F queuedefs.4//

echo x - queuedefs.4.nr
cat > "queuedefs.4.nr" << '//E*O*F queuedefs.4.nr//'



     QUEUEDEFS(4)	       UNIX System V		  QUEUEDEFS(4)



     NAME
	  queuedefs - at/batch/cron queue description file

     SYNOPSIS
	  /usr/lib/cron/queuedefs

     DESCRIPTION
	  The queuedefs file describes the characteristics of the
	  queues managed by cron(1M).  Each non-comment line in this
	  file describes one queue.  The format of the lines are as
	  follows:

	       q.[njobj][nicen][nwaitw]

	  The fields in this line are:

	       q    The name of the queue.  a is the default queue for
		    jobs started by at(1); b is the default queue for
		    jobs started by batch(1); c is the default queue
		    for jobs run from a crontab file.

	       njob The maximum number of jobs that can be run
		    simultaneously in that queue; if more than njob
		    jobs are ready to run, only the first njob jobs
		    will be run, and the others will be run as jobs
		    that are currently running terminate.  The default
		    value is 100.

	       nice The nice(1) value to give to all jobs in that
		    queue that are not run with a user ID of super-
		    user.  The default value is 2.

	       nwait
		    The number of seconds to wait before rescheduling
		    a job that was deferred because more than njob
		    jobs were running in that job's queue, or because
		    more than 25 jobs were running in all the queues.
		    The default value is 60.

	  Lines beginning with # are comments, and are ignored.

     EXAMPLE
	       a.4j1n
	       b.2j2n90w

	  This file specifies that the a queue, for at jobs, can have
	  up to 4 jobs running simultaneously; those jobs will be run
	  with a nice value of 1.  As no nwait value was given, if a
	  job cannot be run because too many other jobs are running
	  cron will wait 60 seconds before trying again to run it.
	  The b queue, for batch jobs, can have up to 2 jobs running
	  simultaneously; those jobs will be run with a nice value of
	  2.  If a job cannot be run because too many other jobs are
	  running, cron will wait 90 seconds before trying again to
	  run it.  All other queues can have up to 100 jobs running
	  simultaneously; they will be run with a nice value of 2, and
	  if a job cannot be run because too many other jobs are
	  running cron will wait 60 seconds before trying again to run
	  it.

     FILES
	  /usr/lib/cron/queuedefs

     SEE ALSO
	  cron(1M)
//E*O*F queuedefs.4.nr//

exit 0
-- 
	-Mike Wescott
	 mike.wescott at ncrcae.Columbia.NCR.COM



More information about the Comp.unix.wizards mailing list