lpschedThe 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 RR or rr: 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 22.) 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:
printer = banner, /dev/hp, make_banner
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 rr. 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 _t_e_m_p_o_r_a_r_y lifetime survives 30 minutes after spooling; one with a _s_h_o_r_t_-_t_e_r_m lifetime survives 24 hours; and one with a _l_o_n_g_-_t_e_r_m 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.