[comp.bugs.sys5] System V -- Information on /usr/lib/cron/.proto

mparker@chip.UUCP (M. D. Parker) (06/19/89)

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?

Thanks again for your help.

Mike Parker
Manager, Systems Administration

campbell@redsox.bsw.com (Larry Campbell) (06/21/89)

Guy Harris posted the answer to this question last November.  Here it
is again:

From: guy@auspex.UUCP (Guy Harris)
Newsgroups: comp.bugs.sys5
Subject: S5 documentation has no man page for "at" ".proto" files
Message-ID: <430@auspex.UUCP>
Date: 10 Nov 88 23:08:35 GMT

...which is kind of rude of it.  Attached is a man page for the S5R3
version; not having S5R2 source on hand, I don't know whether it applies
to the S5R2 version in its entirety or not.

As for the "-q" flag for "at", well, it specifies to which queue the job
should be submitted.  The queue name is a single letter, 'a' through 'z'.

However, some queues have special meanings:

	queue "b" is the "batch" queue, and if you submit a job to
	that queue "at" will not look for a "time to run" argument
	and will tell "cron" to run the job now;

	queue "c" is a pseudo-queue for "cron" jobs, and I don't know
	what happens if you submit a job to that queue - the SunOS 4.0
	"at" won't let you do so, so it may well do Horrible Things if
	you can coax your "at" into letting you do so.

Queue "a" is the default queue.

.TH PROTO 4
.SH NAME
proto \- prototype job file for at
.SH SYNOPSIS
.LP
.B /usr/lib/cron/.proto
.LP
.BI /usr/lib/.proto. queue
.SH DESCRIPTION
.LP
When a job is submitted to
.IR at (1)
or
.IR batch (1),
the job is constructed as a shell script.  First, a prologue is
constructed, consisting of:
.IP \(bu 3
A header whether the job is an
.I at
job or a
.I batch
job (actually,
.I at
jobs submitted to all queues other than queue
.BR a ,
not just to the batch queue
.BR b ,
are listed as
.I batch
jobs); the header will be
.LP
.RS
.nf
.ft B
: at job
.ft R
.fi
.RE
.LP
for an
.I at
job, and
.LP
.RS
.nf
.ft B
: batch job
.ft R
.fi
.RE
.LP
for a
.I batch
job.
.IP \(bu
A set of Bourne shell commands to make the environment (see
.IR environ (5))
for the
.I at
job the same as the current environment;
.IP \(bu
A command to run the user's shell (as specified by the
.SB SHELL
environment variable) with the rest of the job file as input.
.LP
.I At
then reads a \*(lqprototype file,\*(rq and constructs the rest of the
job file from it.
.LP
Text from the prototype file is copied to the job file, except for
special \*(lqvariables\*(rq that are replaced by other text:
.RS
.TP
.B $d
is replaced by the current working directory
.PD 0
.TP
.B $l
is replaced by the current file size limit (see
.IR ulimit (2))
.TP
.B $m
is replaced by the current umask (see
.IR umask (2))
.TP
.B $t
is replaced by the time at which the job should be run, expressed as seconds
since January 1, 1970, 00:00 Greenwich Mean Time, preceded by a colon
.TP
.B $<
is replaced by text read by
.I at
from the standard input (that is, the commands provided to
.I at
to be run in the job)
.PD
.RE
.LP
If the job is submitted in queue
.IR queue ,
.I at
uses the file
.BI /usr/lib/cron/.proto. queue
as the prototype file if it exists, otherwise it will use the file
.BR /usr/lib/cron/.proto .
.SH EXAMPLES
The standard
.B .proto
file supplied is:
.LP
.RS
.nf
.ft B
#ident	"@(#)adm:.proto	1.2"
cd $d
ulimit $l
umask $m
$<
.ft R
.fi
.RE
.LP
which causes commands to change the current directory in the job to the
current directory at the time
.I at
was run, to change the file size limit in the job to the file size limit
at the time
.I at
was run, and to change the umask in the job to the umask at the time
.I at
was run, to be inserted before the commands in the job.
.SH FILES
.PD 0
.TP 20
.B /usr/lib/cron/.proto
.LP
.BI /usr/lib/cron/.proto. queue
.PD 
.SH "SEE ALSO"
.IR at (1)


From wjh12!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!auspex!guy Fri Nov 11 08:34:41 EST 1988
Article 152 of comp.bugs.sys5:
Path: redsox!wjh12!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!auspex!guy
>From: guy@auspex.UUCP (Guy Harris)
Newsgroups: comp.bugs.sys5
Subject: Re: S5 documentation has no man page for "at" ".proto" files
Message-ID: <431@auspex.UUCP>
Date: 10 Nov 88 23:26:04 GMT
References: <430@auspex.UUCP>
Reply-To: guy@auspex.UUCP (Guy Harris)
Organization: Auspex Systems, Santa Clara
Lines: 142

Minor corrections to the previously-posted man page:

.TH PROTO 4
.SH NAME
proto \- prototype job file for at
.SH SYNOPSIS
.LP
.B /usr/lib/cron/.proto
.LP
.BI /usr/lib/cron/.proto. queue
.SH DESCRIPTION
.LP
When a job is submitted to
.IR at (1)
or
.IR batch (1),
the job is constructed as a shell script.  First, a prologue is
constructed, consisting of:
.IP \(bu 3
A header whether the job is an
.I at
job or a
.I batch
job (actually,
.I at
jobs submitted to all queues other than queue
.BR a ,
not just to the batch queue
.BR b ,
are listed as
.I batch
jobs); the header will be
.LP
.RS
.nf
.ft B
: at job
.ft R
.fi
.RE
.LP
for an
.I at
job, and
.LP
.RS
.nf
.ft B
: batch job
.ft R
.fi
.RE
.LP
for a
.I batch
job.
.IP \(bu
A set of Bourne shell commands to make the environment (see
.IR environ (5))
for the
.I at
job the same as the current environment;
.IP \(bu
A command to run the user's shell (as specified by the
.SM SHELL
environment variable) with the rest of the job file as input.
.LP
.I At
then reads a \*(lqprototype file,\*(rq and constructs the rest of the
job file from it.
.LP
Text from the prototype file is copied to the job file, except for
special \*(lqvariables\*(rq that are replaced by other text:
.RS
.TP
.B $d
is replaced by the current working directory
.PD 0
.TP
.B $l
is replaced by the current file size limit (see
.IR ulimit (2))
.TP
.B $m
is replaced by the current umask (see
.IR umask (2))
.TP
.B $t
is replaced by the time at which the job should be run, expressed as seconds
since January 1, 1970, 00:00 Greenwich Mean Time, preceded by a colon
.TP
.B $<
is replaced by text read by
.I at
from the standard input (that is, the commands provided to
.I at
to be run in the job)
.PD
.RE
.LP
If the job is submitted in queue
.IR queue ,
.I at
uses the file
.BI /usr/lib/cron/.proto. queue
as the prototype file if it exists, otherwise it will use the file
.BR /usr/lib/cron/.proto .
.SH EXAMPLES
The standard
.B .proto
file supplied is:
.LP
.RS
.nf
.ft B
#ident	"@(#)adm:.proto	1.2"
cd $d
ulimit $l
umask $m
$<
.ft R
.fi
.RE
.LP
which causes commands to change the current directory in the job to the
current directory at the time
.I at
was run, to change the file size limit in the job to the file size limit
at the time
.I at
was run, and to change the umask in the job to the umask at the time
.I at
was run, to be inserted before the commands in the job.
.SH FILES
.PD 0
.TP 20
.B /usr/lib/cron/.proto
.LP
.BI /usr/lib/cron/.proto. queue
.PD 
.SH "SEE ALSO"
.IR at (1)


-- 
Larry Campbell                          The Boston Software Works, Inc.
campbell@bsw.com                        120 Fulton Street
wjh12!redsox!campbell                   Boston, MA 02146