1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 3<html> 4 <head> 5 <meta name="generator" content="HTML Tidy, see www.w3.org"> 6 <title>Printing a File and Checking Status</title> 7 <meta name="GENERATOR" content= 8 "Modular DocBook HTML Stylesheet Version 1.7"> 9 <link rel="HOME" title=" LPRng Reference Manual" href= 10 "index.htm"> 11 <link rel="UP" title="Print Spooling Tutorial " href= 12 "tutorial.htm"> 13 <link rel="PREVIOUS" title="Restoring Original Configuration" 14 href="restoring.htm"> 15 <link rel="NEXT" title="Selecting the Print Queue" href= 16 "selectingprintqueue.htm"> 17 </head> 18 19 <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link= 20 "#0000FF" vlink="#840084" alink="#0000FF"> 21 <div class="NAVHEADER"> 22 <table summary="Header navigation table" width="100%" border= 23 "0" cellpadding="0" cellspacing="0"> 24 <tr> 25 <th colspan="3" align="center">LPRng Reference Manual: 5 26 Sep 2003 (For LPRng-3.8.22)</th> 27 </tr> 28 29 <tr> 30 <td width="10%" align="left" valign="bottom"><a href= 31 "restoring.htm" accesskey="P">Prev</a></td> 32 33 <td width="80%" align="center" valign="bottom">Chapter 4. 34 Print Spooling Tutorial</td> 35 36 <td width="10%" align="right" valign="bottom"><a href= 37 "selectingprintqueue.htm" accesskey="N">Next</a></td> 38 </tr> 39 </table> 40 <hr align="LEFT" width="100%"> 41 </div> 42 43 <div class="SECT1"> 44 <h1 class="SECT1"><a name="PRINTINGANDCHECKING">4.5. Printing 45 a File and Checking Status</a></h1> 46 47 <p>Try the following commands. The commands appear after the 48 prompt, and sample output that you might see is shown.</p> 49 50 <div class="INFORMALEXAMPLE"> 51 <a name="AEN1896"></a> 52<pre class="SCREEN"> 53 <samp class="PROMPT">h4: {104} %</samp> <kbd class= 54"USERINPUT">lpr -V /tmp/hi</kbd> 55 Version LPRng-3.6.14 56 sending job 'papowell@h4+238' to lp@localhost 57 connecting to 'localhost', attempt 1 58 connected to 'localhost' 59 requesting printer lp@localhost 60 sending control file 'cfA238h4.private' to lp@localhost 61 completed sending 'cfA238h4.private' to lp@localhost 62 sending data file 'dfA238h4.private' to lp@localhost 63 completed sending 'dfA238h4.private' to lp@localhost 64 done job 'papowell@h4+238' transfer to lp@localhost 65</pre> 66 </div> 67 <br> 68 <br> 69 70 <p>The <tt class="COMMAND">lpr -V</tt> (Verbose) option 71 causes <b class="APPLICATION">lpr</b> to print status output. 72 As you can see from the above lines, it first tries to 73 connect to the <b class="APPLICATION">lpd</b> server on host 74 <var class="LITERAL">localhost</var>, then sends a print 75 request (which is accepted), then sends a <span class= 76 "emphasis"><i class="EMPHASIS">control</i></span> file 77 containing information about the job and a <span class= 78 "emphasis"><i class="EMPHASIS">data</i></span> file or files 79 which are copies of the files to be printed.</p> 80 81 <p>If you check the <tt class="FILENAME">/tmp/lp</tt> file 82 and you will find that a copy of <tt class= 83 "FILENAME">/tmp/hi</tt> has been written to it. By default, 84 the <b class="APPLICATION">lpd</b> print spooler acts as a 85 store and forward system, accepting files to be printed, 86 holding them in the print queue, and then forwarding them to 87 the destination system or output device.</p> 88 89 <p>You can use the <b class="APPLICATION">lpq</b> command to 90 view the status of the print job.</p> 91 92 <div class="INFORMALEXAMPLE"> 93 <a name="AEN1913"></a> 94<pre class="SCREEN"> 95 <samp class="PROMPT">h4: {105} %</samp> <kbd class= 96"USERINPUT">lpq</kbd> 97 Printer: lp@h4 98 Queue: no printable jobs in queue 99 Status: job 'papowell@h4+238' removed at 09:39:03.256 100</pre> 101 </div> 102 <br> 103 <br> 104 105 <p>If you want to see more status information, use <tt class= 106 "COMMAND">lpq -l</tt>, <tt class="COMMAND">lpq -ll</tt>, or 107 even <tt class="COMMAND">lpq -L</tt>. The <var class= 108 "LITERAL">-L</var> provides al<var class="LITERAL">L</var> 109 the status.</p> 110 111 <div class="INFORMALEXAMPLE"> 112 <a name="AEN1923"></a> 113<pre class="SCREEN"> 114 <samp class="PROMPT">h4: {106} %</samp> <kbd class= 115"USERINPUT">lpq -l</kbd> 116 Printer: lp@h4 117 Queue: no printable jobs in queue 118 Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112 119 Status: job 'papowell@h4+238' removed at 09:39:03.256 120 <samp class="PROMPT">h4: {107} %</samp> <kbd class= 121"USERINPUT">lpq -ll</kbd> 122 Printer: lp@h4 123 Queue: no printable jobs in queue 124 Status: finished 'papowell@h4+238', status 'JSUCC' at 09:39:03.108 125 Status: subserver pid 8240 exit status 'JSUCC' at 09:39:03.110 126 Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112 127 Status: job 'papowell@h4+238' removed at 09:39:03.256 128 <samp class="PROMPT">h4: {108} %</samp> <kbd class= 129"USERINPUT">lpq -L</kbd> 130 Printer: lp@h4 131 Queue: no printable jobs in queue 132 Status: subserver pid 8240 starting at 09:39:03.105 133 Status: accounting at start at 09:39:03.105 134 Status: opening device '/tmp/lp' at 09:39:03.105 135 Status: printing job 'papowell@h4+238' at 09:39:03.106 136 Status: no banner at 09:39:03.107 137 Status: printing data file 'dfA238h4.private', size 3 at 09:39:03.107 138 Status: printing done 'papowell@h4+238' at 09:39:03.107 139 Status: accounting at end at 09:39:03.108 140 Status: finished 'papowell@h4+238', status 'JSUCC' at 09:39:03.108 141 Status: subserver pid 8240 exit status 'JSUCC' at 09:39:03.110 142 Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112 143 Status: job 'papowell@h4+238' removed at 09:39:03.256 144</pre> 145 </div> 146 <br> 147 <br> 148 149 <p>There are different status formats available as well. The 150 <tt class="COMMAND">lpq -s</tt> (summary) produces a single 151 line of status per spool queue, while the <tt class= 152 "COMMAND">lpq -v</tt> (verbose) produces output that is very 153 suitable for processing with programs such as <b class= 154 "APPLICATION">Perl</b> or <b class="APPLICATION">awk</b>:</p> 155 156 <div class="INFORMALEXAMPLE"> 157 <a name="AEN1936"></a> 158<pre class="SCREEN"> 159 <samp class="PROMPT">h4: {109} %</samp> <kbd class= 160"USERINPUT">lpq -s</kbd> 161 lp@h4 0 jobs 162 <samp class="PROMPT">h4: {110} %</samp> <kbd class= 163"USERINPUT">lpq -v</kbd> 164 Printer: lp@h4 165 Printing: no 166 Aborted: no 167 Spooling: no 168 Queue: no printable jobs in queue 169 SPOOLCONTROL= 170 Status: subserver pid 8240 starting at 09:39:03.105 171 Status: accounting at start at 09:39:03.105 172 Status: opening device '/tmp/lp' at 09:39:03.105 173 Status: printing job 'papowell@h4+238' at 09:39:03.106 174 Status: no banner at 09:39:03.107 175 Status: printing data file 'dfA238h4.private', size 3 at 09:39:03.107 176 Status: printing done 'papowell@h4+238' at 09:39:03.107 177 Status: accounting at end at 09:39:03.108 178 Status: finished 'papowell@h4+238', status 'JSUCC' at 09:39:03.108 179 Status: subserver pid 8240 exit status 'JSUCC' at 09:39:03.110 180 Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112 181 Status: job 'papowell@h4+238' removed at 09:39:03.256 182</pre> 183 </div> 184 <br> 185 <br> 186 187 <p>If you check the <tt class="FILENAME">/tmp/lp</tt> file 188 and you will find that a copy of <tt class= 189 "FILENAME">/tmp/hi</tt> has been written to it. By default, 190 the <b class="APPLICATION">lpd</b> print spooler acts as a 191 store and forward system, accepting files to be printed, 192 holding them in the print queue, and then forwarding them to 193 the destination system or output device.</p> 194 </div> 195 196 <div class="NAVFOOTER"> 197 <hr align="LEFT" width="100%"> 198 199 <table summary="Footer navigation table" width="100%" border= 200 "0" cellpadding="0" cellspacing="0"> 201 <tr> 202 <td width="33%" align="left" valign="top"><a href= 203 "restoring.htm" accesskey="P">Prev</a></td> 204 205 <td width="34%" align="center" valign="top"><a href= 206 "index.htm" accesskey="H">Home</a></td> 207 208 <td width="33%" align="right" valign="top"><a href= 209 "selectingprintqueue.htm" accesskey="N">Next</a></td> 210 </tr> 211 212 <tr> 213 <td width="33%" align="left" valign="top">Restoring 214 Original Configuration</td> 215 216 <td width="34%" align="center" valign="top"><a href= 217 "tutorial.htm" accesskey="U">Up</a></td> 218 219 <td width="33%" align="right" valign="top">Selecting the 220 Print Queue</td> 221 </tr> 222 </table> 223 </div> 224 </body> 225</html> 226 227