COHERENT manpages
This page displays the COHERENT manpage for lpsched [Print jobs spooled with command lp; turn on printer daemon].
List of available manpages
Index
lpsched -- Command
Print jobs spooled with command lp; turn on printer daemon
lpsched
The daemon lpsched prints jobs spooled with the command lp.
Typing the command lpsched by itself launches the daemon. The rest of this
article describes how lpsched manages printing.
Each file in directory /usr/spooler/mlp/queue is a print job spooled by the
command lp. When lp spools a job, it copies the input (usually a file) into
the spool directory and appends to the beginning of each job a 192-byte
header that indicates how the job is to be printed. This header includes
such information as the name of the printer on which to print the job and
the date and time the job was spooled. For a detailed layout of this
header, see the Lexicon entry for lp.
lp also assigned each job a seven-character name. The first character is R
or r: the former indicates that the job is either being printed or is
awaiting printing; whereas the latter indicates that the job has been
printed. The second character is a digit, from zero to nine, that sets the
job's priority: zero gives highest priority, nine lowest. (The default
priority is 2.) The last five characters give a zero-padded identification
number.
lpsched awakens every 30 seconds or whenever the command lp spools a job
for printing. lpsched then processes each file in /usr/spooler/mlp/queue.
It reads each job each that is awaiting printing, the order being dictated
first by the priority code and then by the identification number (which
indicates the order in which the jobs were spooled).
When lpsched actually prints a job, it performs the following tasks:
-> First, it opens the file that contains the job to be printed, and reads
its header. The header gives the number of the job; the name of the
user who spooled the job; the name of the printer device upon which the
job is to be printed; the number of copies to print; and the title of
the job, as set with the lp option -t. (NB, do not confuse an MLP
``device,'' which is set in the file /usr/spool/mlp/controls, with the
physical device into which the printer is plugged.)
-> lpsched then finds the entry in file /usr/spool/mlp/controls that
describes the printer device the user requested. An entry in controls
is of the form
printer = banner, /dev/hp, make_banner
In this case, the MLP device is named banner; the output is to be
printed on physical device /dev/hp; and the output is to be filtered
through backend script make_banner, which is a script kept in directory
/usr/spool/mlp/backend. (For details on how to describe an MLP printer
device, see the Lexicon entry for controls).
-> If the entry for this device does not name a backend script, lpsched
copies the body of the job (that is, the text that you had spooled)
without modification to the device by which the printer is accessed.
-> If the entry for this device does name a backend script, lpsched invokes
the script and redirects its output to the physical device.
When lpsched invokes a backend script, it passes it four arguments: (1) the
number of the job to be printed, (2) the login identifier of the user who
spooled the job, (3) the number of copies to be printed, and (4) the title
of the job. The script can ignore these arguments, or use them in its
filtration process; for example, it can use the fourth argument to
construct a banner page that is printed before the job. For examples of
backend script that perform various types of sophisticated processing, see
the Lexicon entry for controls.
lpsched uses a system of lock files to ensure that each device is accessed
in a disciplined manner. For details on COHERENT's system of building lock
files, see the Lexicon entries for UUCP and libmisc.
To abort the printing of a job, invoke the command cancel. Note that this
only affects jobs that are being spooled or waiting to be spooled. If a
job has been downloaded to a printer, the only way to abort printing is to
manipulate the printer itself through its front panel and switches.
When a job has printed successfully, lpsched changes the status character
in its name to r. A file remains in the spool directory until its
``lifetime'' has expired. You can reprint a quiescent file by invoking the
command reprint. To change a job's target printer, priority, or lifetime,
use the command chreq. For details on these commands, see their Lexicon
entries.
lpsched awakens whenever you use the command lp to spool a job for
printing. It also awakens every five minutes, whether or not a job has
been spooled, to see if anything needs to be printed and check quiescent
files.
After it has processed every job that awaits printing, lpsched reads the
header of every quiescent file. If a file's ``lifetime'' has expired,
lpsched removes it. A file with a temporary lifetime survives 30 minutes
after spooling; one with a short-term lifetime survives 24 hours; and one
with a long-term lifetime survives 72 hours. You can change these defaults
by editing controls; for details, see its entry in the Lexicon. By
default, a job is given a short-term life expectancy. To change a job's
life expectancy, use the command chreq.
The command lpsched turns on lpsched; and command lpshut turns it off.
Jobs spooled while lpsched is turned off remain spooled until lpsched is
reawakened.
See Also
Administering COHERENT,
commands,
lp,
lpshut,
printer