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