1
0

lp.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <html>
  2. <title>
  3. data
  4. </title>
  5. <body BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#330088" ALINK="#FF0044">
  6. <H1>A Guide to the Lp
  7. Printer Spooler
  8. </H1>
  9. <DL><DD><I>Paul Glick<br>
  10. pg@plan9.bell-labs.com<br>
  11. </I></DL>
  12. <DL><DD><H4>ABSTRACT</H4>
  13. <P>
  14. <I>Lp</I>
  15. is a collection of programs used to provide an easy-to-use
  16. interface for printing a variety of document types on a variety
  17. of printers.
  18. <I>Lp</I>
  19. is the glue that connects various document language
  20. translators and printer communication programs together so that
  21. the users may have a consistent view of printers.
  22. Most of the glue
  23. is shell script, which can be easily modified.
  24. The user need not
  25. specify options to get sensible output in most cases.
  26. <I>Lp</I>
  27. is described here
  28. so that others may make additions and changes.
  29. </DL>
  30. </P>
  31. <H4>1 Introduction
  32. </H4>
  33. <P>
  34. <I>Lp</I>
  35. is used to format and print data on a variety of output devices.
  36. The need for
  37. <I>lp</I>
  38. was rooted in the inability of other printer spoolers to do simple
  39. tasks without a great deal of user specification of options.
  40. At the time
  41. <I>lp</I>
  42. was written, there were several printer
  43. languages, such as ImPress and PostScript, and
  44. an internally developed printer that would accept
  45. <I>troff</I>
  46. output.
  47. Now, all our printers take PostScript,
  48. but printers that use HPCL and HPGL abound and
  49. support for those printers may be added easily.
  50. A great deal of what underlies
  51. <I>lp</I>
  52. is taken from BSD's
  53. <I>lpr</I>
  54. and System V's
  55. <I>lp</I>.
  56. The important features of this system are that most of the programs
  57. are easily modified shell scripts and the user need not
  58. learn to use the large amount of underlying software developed by others.
  59. <I>Lp</I>
  60. runs under Plan 9 and several flavors of
  61. UNIX.
  62. This document deals with
  63. <I>lp</I>
  64. as it relates to Plan 9.
  65. <I>Lp</I>
  66. was developed using both Datakit and Ethernet to transport data between machines.
  67. Now only the Ethernet transport mechanism remains.
  68. </P>
  69. <P>
  70. Text, graphics, and formatted text files are appropriately processed and
  71. placed into a spool directory from which they are taken to be printed by a daemon process.
  72. Additional functions include checking the status of a printer queue
  73. and removing jobs from the printer queue.
  74. </P>
  75. <P>
  76. All the shell scripts (see
  77. <A href="/magic/man2html/1/rc"><I>rc</I>(1))
  78. </A>associated with
  79. <I>lp</I>
  80. reside in the spool directory
  81. <TT>/sys/lib/lp</TT>
  82. except for the
  83. <I>lp</I>
  84. command itself, which resides in
  85. <TT>/rc/bin</TT>.
  86. Commands related to
  87. <I>lp</I>
  88. that are not shell scripts can most often be found
  89. in
  90. <TT>/$cputype/bin/aux</TT>.
  91. The directory where all the
  92. <I>lp</I>
  93. scripts reside is defined within
  94. <I>lp</I>
  95. by the shell variable
  96. <TT>LPLIB</TT>.
  97. In the remainder of this document, file names will be specified
  98. with this shell variable as their root.
  99. </P>
  100. <H4>2 Usage
  101. </H4>
  102. <P>
  103. <I>Lp</I>
  104. requires an output device to be specified
  105. before it will process input.
  106. This can be done in any of three ways described here.
  107. </P>
  108. <DL COMPACT>
  109. <DT>1)<DD>
  110. The file
  111. <TT>$LPLIB/defdevice</TT>
  112. may contain the name of a default output device.
  113. This may not be practical for environments where
  114. there are many printers.
  115. <DT>2)<DD>
  116. The user's environment variable
  117. <TT>LPDEST</TT>
  118. may be set to the name of the device to be used.
  119. This is often a more practical solution when there are several printers
  120. available.
  121. This overrides a
  122. <TT>defdevice</TT>
  123. specification.
  124. <DT>3)<DD>
  125. The
  126. <TT>-d</TT>
  127. <I>printer</I>
  128. option to the
  129. <I>lp</I>
  130. command specifies
  131. <I>printer</I>
  132. as the device to which output should be directed, overriding the
  133. previous two specifications.
  134. </dl>
  135. <P>
  136. <br>
  137. If
  138. <I>printer</I>
  139. is
  140. <TT>?</TT>,
  141. a list of printers and other information in the
  142. <TT>devices</TT>
  143. file is printed, as shown in Figure 1.
  144. Quote the question mark to prevent it from being
  145. interpreted by the shell language as a metacharacter.
  146. <DL><DT><DD><TT><PRE>
  147. % lp -d'?'
  148. device location host class
  149. fn 2C-501 helix post/2+600dpi+duplex
  150. pcclone - - post+nohead
  151. peacock 2C-501 cetus post/2+300dpi+nohead+color
  152. ps83 st8_fl3 rice post+300dpi+reverse
  153. psu 2C-501 cetus post/2+1200dpi
  154. .
  155. .
  156. .
  157. %
  158. </PRE></TT></DL>
  159. <I>Figure 1. Sample listing of installed printers</I>
  160. </P>
  161. <P>
  162. Normally,
  163. <I>lp</I>
  164. uses the
  165. <TT>file</TT>
  166. command to figure out what type of input it is receiving.
  167. This is done within the
  168. <TT>generic</TT>
  169. process which is discussed later in this paper in the
  170. <B>Process directory</B>
  171. section.
  172. To select a specific input processor the
  173. <TT>-p</TT><I>process</I>
  174. option is used where
  175. <I>process</I>
  176. is one of the shell scripts in the
  177. <TT>process</TT>
  178. directory.
  179. </P>
  180. <br>&#32;<br>
  181. Troff
  182. output can be printed, in this case, on printer
  183. <I>fn</I>
  184. with
  185. <DL><DT><DD><TT><PRE>
  186. % troff -ms lp.ms | lp -dfn
  187. </PRE></TT></DL>
  188. <br>&#32;<br>
  189. A file can be converted to PostScript using the pseudo-printer
  190. <TT>stdout</TT>:
  191. <DL><DT><DD><TT><PRE>
  192. % troff -ms lp.ms | lp -dstdout &#62; lp.ps
  193. </PRE></TT></DL>
  194. LaTeX (and analogously TeX)
  195. documents are printed in two steps:
  196. <DL><DT><DD><TT><PRE>
  197. % latex lp.tex
  198. .
  199. .
  200. % lp lp.dvi
  201. .
  202. .
  203. %
  204. </PRE></TT></DL>
  205. LaTeX
  206. produces a `.dvi' file and
  207. does not permit the use of a pipe
  208. connection to the standard input of
  209. <I>lp</I>.
  210. To look at the status and queue of a device, use
  211. <TT>-q</TT>:
  212. <DL><DT><DD><TT><PRE>
  213. % lp -dpsu -q
  214. daemon status:
  215. : 67.17% sent
  216. printer status:
  217. %%[ status: busy; source: lpd ]%%
  218. queue on cetus:
  219. job user try size
  220. rice29436.1 pg 0 17454
  221. slocum17565.1 ches 1 49995
  222. %
  223. </PRE></TT></DL>
  224. This command can print the status and queue of the local
  225. and remote hosts.
  226. Administrators should be advised that working in an environment where the
  227. <I>lp</I>
  228. spool directory is shared among the local and remote hosts,
  229. no spooling should be done on the local hosts.
  230. The format of the status and queue printout is up to the administrator.
  231. The job started above can be killed with
  232. <TT>-k</TT>:
  233. <DL><DT><DD><TT><PRE>
  234. $ lp -dpsu -k rice29436.1
  235. rice29436.1 removed from psu queue on cetus
  236. </PRE></TT></DL>
  237. <H4>3 Options
  238. </H4>
  239. <P>
  240. There are options available to modify the way in which a job is handled.
  241. It is the job of the
  242. <I>lp</I>
  243. programs to convert the option settings so they may be used by each of the
  244. different translation and interface programs.
  245. Not all options are applicable to all printer environments.
  246. Table 1 lists the standard
  247. <I>lp</I>
  248. options, the shell variable settings, and description of the options.
  249. <br>&#32;<br>
  250. <br><img src="data.15750.gif"><br>
  251. <br>&#32;<br>
  252. <I>Table 1. Lp Option List</I>
  253. <br>&#32;<br>
  254. </P>
  255. <H4>4 Devices file
  256. </H4>
  257. <P>
  258. The
  259. <TT>devices</TT>
  260. file is found in the spool directory.
  261. Each line in the file is composed of 12 fields, separated
  262. by tabs or spaces, that describe the attributes
  263. of the printer and how it should be serviced.
  264. Within the
  265. <TT>lp</TT>
  266. command, a shell variable is set for each attribute;
  267. the following list describes them:
  268. </P>
  269. <DL COMPACT>
  270. <DT><TT>0<DD>
  271. LPDEST0</TT> is the name of the device as given to
  272. <I>lp</I>
  273. with the
  274. <TT>-d</TT>
  275. option
  276. or as specified by the shell environment variable
  277. <TT>LPDEST</TT>
  278. or as specified by
  279. the file
  280. <TT>$LPLIB/defdevice</TT>.
  281. This name is used in creating directories and log files that are associated with
  282. the printers operation.
  283. <DT><TT>0<DD>
  284. LOC0</TT> just describes where the printer is physically located.
  285. <DT><TT>0<DD>
  286. DEST_HOST0</TT> is the host from which the files are printed.
  287. Files may be spooled on other machines before being transferred to the
  288. destination host.
  289. <DT><TT>0<DD>
  290. OUT_DEV0</TT> is the physical device name or network address needed by the printer daemon
  291. to connect to the printer.
  292. This field depends on the requirements of the daemon and may contain a `&#191;'
  293. if not required.
  294. <DT><TT>0<DD>
  295. SPEED0</TT> is the baud rate setting for the port.
  296. This field depends on the requirements of the daemon and may contain a `&#191;'
  297. if not required.
  298. <DT><TT>0<DD>
  299. LPCLASS0</TT> is used to encode minor printer differences.
  300. The keyword
  301. <TT>reverse</TT>
  302. is used by some of the preprocessors
  303. to reverse the order the pages are printed to accommodate different output
  304. trays (either face up or face down).
  305. The keyword
  306. <TT>nohead</TT>
  307. is used to suppress the header page.
  308. This is used for special and color printers.
  309. The keyword
  310. <TT>duplex</TT>
  311. is used to coax double sided output from duplex printers.
  312. <DT><TT>0<DD>
  313. LPPROC0</TT> is the command from the
  314. <TT>LPLIB/process</TT>
  315. directory to be used to convert input to a format
  316. that will be accepted by the device.
  317. The preprocessor is invoked by the spooler.
  318. <DT><TT>0<DD>
  319. SPOOLER0</TT> is the command from the
  320. <TT>LPLIB/spooler</TT>
  321. directory which will select files using the
  322. <TT>SCHED</TT>
  323. command and invoke the
  324. <TT>LPPROC</TT>
  325. command, putting its output
  326. into the remote spool directory.
  327. The output is sent directly to the spool directory on the
  328. destination machine to avoid conflicts when client and
  329. server machines share spool directories.
  330. <DT><TT>0<DD>
  331. STAT0</TT> is the command from the
  332. <TT>LPLIB/stat</TT>
  333. directory that prints the status of the device and the list of jobs
  334. waiting on the queue for the device.
  335. The status information depends on what is available from the printer
  336. and interface software.
  337. The queue information should be changed to show information
  338. useful in tracking down problems.
  339. The
  340. <TT>SCHED</TT>
  341. command is used to show the jobs in the order
  342. in which they will be printed.
  343. <DT><TT>0<DD>
  344. KILL0</TT> is the command from the
  345. <TT>LPLIB/kill</TT>
  346. that removes jobs from the queue.
  347. The jobs to be removed are given as arguments to the
  348. <I>lp</I>
  349. command.
  350. When possible, it should also abort the currently running job
  351. if it has to be killed.
  352. <DT><TT>0<DD>
  353. DAEMON0</TT> is the command from the
  354. <TT>LPLIB/daemon</TT>
  355. that is meant to run asynchronously to remove
  356. jobs from the queue.
  357. Jobs may either be passed on to another host or sent to the
  358. printing device.
  359. <I>Lp</I>
  360. always tries to start a daemon process when one is specified.
  361. <DT><TT>0<DD>
  362. SCHED0</TT> is the command from the
  363. <TT>LPLIB/sched</TT>
  364. that is used to present the job names to the
  365. daemon and stat programs
  366. in some order, e.g., first-in-first-out, smallest first.
  367. </dl>
  368. <H4>5 Support programs
  369. </H4>
  370. <P>
  371. The following sections describe the basic functions of the programs
  372. that are found in the subdirectories of
  373. <TT>$LPLIB</TT>.
  374. The programs in a specific directory vary with the
  375. type of output device or networks that have to be used.
  376. </P>
  377. <H4>5.1 Process directory
  378. </H4>
  379. <P>
  380. The
  381. <TT>generic</TT>
  382. preprocessor
  383. is the default preprocessor for most printers.
  384. It uses the
  385. <A href="/magic/man2html/1/file"><I>file</I>(1)
  386. </A>command to determine the format of the input file.
  387. The appropriate preprocessor is then selected to transform the
  388. file to a format suitable for the printer.
  389. </P>
  390. <P>
  391. Here is a list of some of the preprocessors and
  392. a description of their function.
  393. A complete list of preprocessors and their descriptions can be found in the manual page
  394. <A href="/magic/man2html/8/lp"><I>lp</I>(8).
  395. </A><br>&#32;<br>
  396. </P>
  397. <DL COMPACT>
  398. <DT><TT>dvipost</TT><DD>
  399. Converts TeX or LaTeX output (<TT>.dvi</TT> files) to PostScript
  400. <DT><TT>ppost</TT><DD>
  401. Converts UTF text to PostScript.
  402. The default font is Courier with Lucida fonts filling in
  403. the remainder of the (available) Unicode character space.
  404. <DT><TT>tr2post</TT><DD>
  405. Converts (device independent) troff output for the device type
  406. <TT>utf</TT>.
  407. See
  408. <TT>/sys/lib/troff/font/devutf</TT>
  409. directory for troff font width table descriptions.
  410. See also the
  411. <TT>/sys/lib/postscript/troff</TT>
  412. directory for mappings of
  413. troff
  414. <TT>UTF</TT>
  415. character space to PostScript font space.
  416. <DT><TT>p9bitpost</TT><DD>
  417. Converts Plan 9 bitmaps (see
  418. <I>bitfile</I>(9.6))
  419. to PostScript.
  420. <DT><TT>g3post</TT><DD>
  421. Converts fax (CCITT-G31 format) to PostScript.
  422. <DT><TT>hpost</TT><DD>
  423. Does header page processing and page reversal processing, if
  424. necessary.
  425. Page reversal is done here so the header page always comes
  426. out at the beginning of the job.
  427. Header page processing is very location-dependent.
  428. </dl>
  429. <H4>5.2 Spool directory
  430. </H4>
  431. <P>
  432. The
  433. <TT>generic</TT>
  434. spooler is responsible for executing the preprocessor
  435. and directing its output to a file in the printer's queue.
  436. An additional file is created containing information such as the system name,
  437. user id, job number, and number of times this job was attempted.
  438. </P>
  439. <P>
  440. Certain printer handling programs do not require separate
  441. preprocessing and spooling.
  442. For such circumstances a
  443. <TT>nospool</TT>
  444. spooler is available that just executes the preprocessing program.
  445. The processing and spooling functions are assumed by this program and the output is sent to
  446. <TT>OUT_DEV</TT>
  447. or standard output if
  448. <TT>OUT_DEV</TT>
  449. is '-'.
  450. </P>
  451. <P>
  452. The
  453. <TT>pcclone</TT>
  454. spooler is used to send print jobs directly to a printer connected
  455. to a 386 compatible printer port (See
  456. <A href="/magic/man2html/3/lpt"><I>lpt</I>(3)).
  457. </A></P>
  458. <H4>5.3 Stat directory
  459. </H4>
  460. <P>
  461. The function of the shell scripts in the
  462. <TT>stat</TT>
  463. directory is to present status information about the
  464. printer and its queue.
  465. When necessary, the
  466. <TT>stat</TT>
  467. scripts may be designed
  468. to return information about the local queue as well as the remote queue.
  469. This is not done on Plan 9 because many systems share the same queue directory.
  470. The scheduler is used to print the queue in the order in which the jobs
  471. will be executed.
  472. </P>
  473. <H4>5.4 Kill directory
  474. </H4>
  475. <P>
  476. The
  477. <TT>kill</TT>
  478. scripts receive command line arguments passed to them by
  479. <I>lp</I>
  480. and remove the job and id files which match the arguments
  481. for the particular queue.
  482. When a job is killed, the generic kill procedure:
  483. </P>
  484. <DL COMPACT>
  485. <DT>1)<DD>
  486. kills the daemon for this queue if the job being killed
  487. is first in the queue,
  488. <DT>2)<DD>
  489. removes the files associated with the job from the queue,
  490. <DT>3)<DD>
  491. attempts to restart the daemon.
  492. </dl>
  493. <H4>5.5 Daemon directory
  494. </H4>
  495. <P>
  496. The
  497. <TT>daemon</TT>
  498. shell scripts are the last to be invoked by
  499. <I>lp</I>
  500. if the
  501. <TT>-Q</TT>
  502. option has not been given.
  503. The daemon process is executed asynchronously
  504. with its standard output and standard error appended to
  505. the printer log file.
  506. The log file is described in a subsequent section.
  507. Because the daemon runs asynchronously, it must
  508. catch signals that could cause it to terminate abnormally.
  509. The daemon first checks to see that it is the only one running
  510. by using the
  511. <TT>LOCK</TT>
  512. program found in the
  513. <TT>/$cputype/bin/aux</TT>
  514. directory.
  515. The
  516. <TT>LOCK</TT>
  517. command creates a
  518. <TT>LOCK</TT>
  519. file in the printer's queue directory.
  520. The daemon then executes the scheduler to obtain the name of the
  521. next job on the queue.
  522. </P>
  523. <P>
  524. The processing of jobs may entail transfer to another host
  525. or transmission to a printer.
  526. The details of this are specific to the individual daemons.
  527. If a job is processed without error, it is removed from the queue.
  528. If a job does not succeed, the associated files may be
  529. moved to a printer specific directory in
  530. <TT>$LPLIB/prob</TT>.
  531. In either case, the daemon can make an entry in the printer's
  532. log file.
  533. Before exiting, the daemon should clean up lock files by calling
  534. <TT>UNLOCK</TT>.
  535. </P>
  536. <P>
  537. Several non-standard daemon programs have been designed
  538. to suit various requirements and whims.
  539. One such program announces job completion and empty paper trays
  540. by causing icons to appear in peoples'
  541. <TT>seemail</TT>
  542. window.
  543. Another, using a voice synthesizer, makes verbal announcements.
  544. Other daemons may be designed to taste.
  545. </P>
  546. <H4>5.6 Sched directory
  547. </H4>
  548. <P>
  549. The scheduler must decide which job files should be executed and
  550. in what order.
  551. The most commonly used scheduler program is
  552. <TT>FIFO</TT>,
  553. which looks like this:
  554. <DL><DT><DD><TT><PRE>
  555. ls -tr $* | sed -n -e 's/.* *//' \
  556. -e '/^[0-9][0-9]*.[1-9][0-9]*$/p'
  557. </PRE></TT></DL>
  558. This lists all the job files in this printer's queue in modification
  559. time order.
  560. Jobs entering the queue have a dot (.) prefixed to their name
  561. to keep the scheduler from selecting them before they are complete.
  562. </P>
  563. <H4>6 Where Things Go Wrong
  564. </H4>
  565. <P>
  566. There are four directories where
  567. <I>lp</I>
  568. writes files.
  569. On the Plan 9 release these directories may be found
  570. in a directory on a scratch filesystem that is not
  571. backed-up.
  572. This directory is
  573. <TT>/n/emelieother/lp</TT>.
  574. It is built on top of a file system
  575. <TT>other</TT>
  576. that is mounted on the file server
  577. <TT>emelie</TT>.
  578. The four directories in
  579. this scratch directory
  580. are
  581. <TT>log</TT>,
  582. <TT>prob</TT>,
  583. <TT>queue</TT>,
  584. and
  585. <TT>tmp</TT>.
  586. <I>Lp</I>
  587. binds (see
  588. <A href="/magic/man2html/1/bind"><I>bind</I>(1))
  589. </A>the first three into the directory
  590. <TT>/sys/lib/lp</TT>
  591. for its processes and their children.
  592. The
  593. <TT>tmp</TT>
  594. directory is bound to the
  595. <TT>/tmp</TT>
  596. directory so that the lp daemons, which run as user `none',
  597. may write into this directory.
  598. </P>
  599. <P>
  600. On any new installation, it is important that these directories
  601. be set up and that the
  602. <I>/rc/bin/lp</I>
  603. command be editted to reflect the change.
  604. If you do not have a scratch filesystem for these directories,
  605. create the four directories
  606. <TT>log</TT>,
  607. <TT>prob</TT>,
  608. <TT>queue</TT>,
  609. and
  610. <TT>tmp</TT>
  611. in
  612. <TT>$LPLIB</TT>
  613. <TT>(/sys/lib/lp)</TT>
  614. so that they are writable by anyone.
  615. </P>
  616. <H4>6.1 Log directory
  617. </H4>
  618. <P>
  619. The log files for a particular
  620. <I>printer</I>
  621. appear in a subdirectory of the spool directory
  622. <TT>log</TT>/<I>printer</I>.
  623. There are currently two types of log files.
  624. One is for the daemon to log errors and successful completions
  625. of jobs.
  626. These are named
  627. <I>printer.day</I>
  628. where
  629. <I>day</I>
  630. is the three letter abbreviation for the day of the week.
  631. These are overwritten once a week to avoid the need for regular
  632. cleanup.
  633. The other type of log file contains the status of the printer and
  634. is written by the program that communicates with the printer itself.
  635. These are named
  636. <I>printer</I>.<TT>st</TT>.
  637. These are overwritten with each new job and are saved in the
  638. <TT>$LPLIB/prob</TT>
  639. directory along with the job under circumstances described below.
  640. When a printer does not appear to be functioning these files are the
  641. place to look first.
  642. </P>
  643. <H4>6.2 Prob directory
  644. </H4>
  645. <P>
  646. When a job fails to produce output,
  647. the log files should be checked for any obvious problems.
  648. If none can be found, a directory with full read and write permissions
  649. should be created with the name of the printer in the
  650. <TT>$LPLIB/prob</TT>
  651. directory.
  652. Subsequent failure of a job will cause the daemon to leave a
  653. copy of the job and the printer communication log in
  654. <TT>$LPLIB/prob/</TT><I>printer</I>
  655. directory.
  656. It is common for a printer to enter states from which
  657. it cannot be rescued except by manually cycling the power on the printer.
  658. After this is done the print daemon should recover by itself
  659. (give it a minute).
  660. If it does not recover, remove the
  661. <TT>LOCK</TT>
  662. file from the printer's spool directory to kill the daemon.
  663. The daemon will have to be restarted by sending another job
  664. to the printer.
  665. For PostScript printers just use:
  666. <DL><DT><DD><TT><PRE>
  667. echo '%!PS' | lp
  668. </PRE></TT></DL>
  669. </P>
  670. <H4>6.3 Repairing Stuck Daemons
  671. </H4>
  672. <P>
  673. There are conditions that occur which are not handled
  674. by the daemons.
  675. One such problem can only be described as the printer entering a
  676. comatose state.
  677. The printer does not respond to any messages sent to it.
  678. The daemon should recover from the reset and an error message
  679. will appear in the log files.
  680. If all else fails, one can kill the first job in the queue
  681. or remove the
  682. <TT>LOCK</TT>
  683. file from the queue directory.
  684. This will kill the daemon, which will have to be restarted.
  685. </P>
  686. <H4>7 Interprocessor Communication
  687. </H4>
  688. <P>
  689. A Plan 9 CPU server can be set up as a printer's spooling host.
  690. That is, the machine where jobs are spooled and from which those jobs
  691. are sent directly to the printer.
  692. To do this, the CPU must listen on TCP port 515 which is the well known
  693. port for the BSD line printer daemon.
  694. The file
  695. <TT>/rc/bin/service/tcp515</TT>
  696. is executed when a call comes in on that port.
  697. The Plan 9
  698. <TT>lpdaemon</TT>
  699. will accept jobs sent from BSD LPR/LPD systems.
  700. The
  701. <TT>/$cputype/bin/aux/lpdaemon</TT>
  702. command is executed from the service call and it accepts print jobs, requests for status,
  703. and requests to kill jobs.
  704. The command
  705. <TT>/$cputype/bin/aux/lpsend</TT>
  706. is used to send jobs
  707. to other Plan 9 machines and is usually called from
  708. within a spooler or daemon script.
  709. The command
  710. <TT>/$cputype/bin/aux/lpdsend</TT>
  711. is used to send jobs
  712. to machines and printers that use the BSD LPR/LPD protocol and is also usually called from
  713. within a spooler or daemon script.
  714. </P>
  715. <H4>8 Acknowledgements
  716. </H4>
  717. <P>
  718. Special thanks to Rich Drechsler for supplying and maintaining most of
  719. the PostScript translation and interface programs,
  720. without which
  721. <I>lp</I>
  722. would be an empty shell.
  723. Tomas Rokicki provided the
  724. TeX
  725. to PostScript
  726. translation program.
  727. </P>
  728. <H4>9 References
  729. </H4>
  730. <br>&#32;<br>
  731. [Camp86] Ralph Campbell,
  732. ``4.3BSD Line Printer Spooler Manual'', UNIX System Manager's Manual,
  733. May, 1986, Berkeley, CA
  734. <br>
  735. [RFC1179] Request for Comments: 1179, Line Printer Daemon Protocol, Aug 1990
  736. <br>
  737. [Sys5] System V manual, date unknown
  738. <br>&#32;<br>
  739. <A href=http://www.lucent.com/copyright.html>
  740. Copyright</A> &#169; 2000 Lucent Technologies Inc. All rights reserved.
  741. </body></html>