File: controllingprintqueue.htm

package info (click to toggle)
lprng 3.8.10-1.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 13,076 kB
  • ctags: 4,348
  • sloc: ansic: 35,394; sh: 10,756; perl: 2,210; makefile: 1,046
file content (431 lines) | stat: -rw-r--r-- 17,105 bytes parent folder | download
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org">
    <title>Controlling the Print Queue</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="Selecting the Print Queue" href=
    "selectingprintqueue.htm">
    <link rel="NEXT" title="Job Removal" href="jobremoval.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=
          "selectingprintqueue.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=
          "jobremoval.htm" accesskey="N">Next</a></td>
        </tr>
      </table>
      <hr align="LEFT" width="100%">
    </div>

    <div class="SECT1">
      <h1 class="SECT1"><a name="CONTROLLINGPRINTQUEUE">4.7.
      Controlling the Print Queue</a></h1>

      <p>The <b class="APPLICATION">lpc</b> command is used to
      examine and control the print server operation. The <tt
      class="COMMAND">lpc status</tt> command displays the
      administrative status of a print queue. The <b class=
      "APPLICATION">lpd</b> program caches status and job
      information in order to improve performance. The <tt class=
      "COMMAND">lpc flush</tt> command will flush the cached
      information and cause the server to regenerate it. The <tt
      class="COMMAND">lpc enable</tt> and <tt class="COMMAND">lpc
      disable</tt> commands enable or disable spooling to the print
      queue, and the <tt class="COMMAND">lpc stop</tt> and <tt
      class="COMMAND">lpc start</tt> commands stop and start
      printing (or transfers) of jobs in the print queue.</p>

      <p>Let's look at the status displayed when we use these
      commands:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN1950"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {120} %</tt> <tt class=
"USERINPUT"><b>lpc status</b></tt>
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4      enabled  enabled    0    none    none
    <tt class="PROMPT">h4: {121} %</tt> <tt class=
"USERINPUT"><b>lpc status all</b></tt>
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4      enabled  enabled    0    none    none
    lp2@h4     enabled  enabled    0    none    none
    <tt class="PROMPT">h4: {122} %</tt> <tt class=
"USERINPUT"><b>lpc</b></tt>
    lpc&gt;status
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4      enabled  enabled    0    none    none
    lpc&gt;status all
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4      enabled  enabled    0    none    none
    lp2@h4     enabled  enabled    0    none    none
    lpc&gt;quit
</pre>
      </div>
      <br>
      <br>

      <p>The <b class="APPLICATION">lpc</b> command can be used in
      command line or interactive mode as shown above. When used
      with no parameters it will run in interactive mode, reading
      one or more commands from its standard input (<span class=
      "ACRONYM">STDIN</span>). The <tt class="COMMAND">lpc
      status</tt> command shows the administrative status of the
      select print queue. The <tt class="LITERAL">all</tt> queue
      name selects all print queues for display. As shown in the
      above example, both print queues have printing and spooling
      enabled and there are no jobs in the print queue. The <i
      class="EMPHASIS">Server</i> and <i class=
      "EMPHASIS">Subserver</i> information shows if there is a
      process which is printing jobs, and its helper process that
      does the actual communication with the printer.</p>

      <p>It might be puzzling at first why <b class=
      "APPLICATION">LPRng</b> uses two processes for this
      operation, but the reason is very simple. Many operating
      system implementations have <i class="EMPHASIS">memory
      leaks</i> that cause the actual process size to grow as it
      runs. This is especially true if a large number of databases
      such as the password, Domain Name Server, or other system
      database is consulted frequently with different queries.
      Since this is usually done quite a lot by the process which
      deals with the actual printing, the printing process would
      soon grow very large and then die when it could no longer
      obtain more memory. The <i class="EMPHASIS">Server</i>
      process will fork or create a child process <i class=
      "EMPHASIS">Subserver</i> process that is responsible for the
      printing of a single job. When the job printing has been
      completed, the <i class="EMPHASIS">Subserver</i> process will
      exit and the <i class="EMPHASIS">Server</i> process will then
      create another child until there are no more jobs to be
      printed. The <i class="EMPHASIS">Redirect</i> and <i class=
      "EMPHASIS">Debug</i> fields will be discussed in later
      sections.</p>

      <p>Now let's use the basic spool queue control commands:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN1975"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {123} %</tt> <tt class=
"USERINPUT"><b>lpc disable</b></tt>
    Printer: lp@h4
    lp@h4.private: disabled
    <tt class="PROMPT">h4: {124} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4  (spooling disabled)
     Queue: no printable jobs in queue
    <tt class="PROMPT">h4: {125} %</tt> <tt class=
"USERINPUT"><b>lpc enable</b></tt>
    Printer: lp@h4
    lp@h4.private: enabled
    <tt class="PROMPT">h4: {126} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4
     Queue: no printable jobs in queue
    <tt class="PROMPT">h4: {127} %</tt> <tt class=
"USERINPUT"><b>lpc stop</b></tt>
    Printer: lp@h4
    lp@h4.private: stopped
    <tt class="PROMPT">h4: {128} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4  (printing disabled)
     Queue: no printable jobs in queue
    <tt class="PROMPT">h4: {129} %</tt> <tt class=
"USERINPUT"><b>lpc start</b></tt>
    Printer: lp@h4
    lp@h4.private: started
    <tt class="PROMPT">h4: {130} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4
     Queue: no printable jobs in queue
</pre>
      </div>
      <br>
      <br>

      <p>As we can see, the <b class="APPLICATION">lpc</b> command
      also reports on the status of the print queue. Let's see what
      happens when we print to a stopped queue:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN1995"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {131} %</tt> <tt class=
"USERINPUT"><b>lpc stop</b></tt>
    Printer: lp@h4
    lp@h4.private: stopped
    <tt class="PROMPT">h4: {132} %</tt> <tt class=
"USERINPUT"><b>lpr /tmp/hi</b></tt>
    <tt class="PROMPT">h4: {133} %</tt> <tt class=
"USERINPUT"><b>lpr /tmp/hi /tmp/there</b></tt>
    <tt class="PROMPT">h4: {134} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4  (printing disabled)
     Queue: 2 printable jobs
     Server: no server active
     Rank   Owner/ID               Class Job Files            Size Time
    1      papowell@h4+17920         A 17920 /tmp/hi             3 18:14:22
    2      papowell@h4+17922         A 17922 /tmp/hi,/tmp/there  9 18:14:30
    <tt class="PROMPT">h4: {135} %</tt> <tt class=
"USERINPUT"><b>lpc status</b></tt>
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4     disabled  enabled    2    none    none
</pre>
      </div>
      <br>
      <br>

      <p>The <b class="APPLICATION">lpc</b> status shows that we
      have two jobs spooled. The <i class="EMPHASIS">Rank</i> field
      shows the order, the <tt class="FILENAME">Owner/ID</tt> shows
      the unique job ID that is assigned to the job and the <i
      class="EMPHASIS">Class</i> field is the job class (this may
      be changed with the <tt class="COMMAND">lpr -C class</tt>
      option). The <i class="EMPHASIS">Job</i> field shows the <i
      class="EMPHASIS">job number</i> assigned to this job in this
      particular spool queue. While the <span class=
      "ACRONYM">ID</span> value never changes as a job moves
      through the <b class="APPLICATION">LPRng</b> system, the <i
      class="EMPHASIS">job number</i> is specific to a particular
      spool queue and may change if a job is <i class=
      "EMPHASIS">forwarded</i> to another spool queue that has a
      job with the same job number. The <i class=
      "EMPHASIS">Size</i> field is the total number of printable
      bytes in the job, and the <i class="EMPHASIS">Time</i> field
      shows the timestamp associated with the job.</p>

      <p>Now let's start the print queue and watch what
      happens.</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN2022"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {136} %</tt> <tt class=
"USERINPUT"><b>lpc start</b></tt>
    Printer: lp@h4
    lp@h4.private: started
    <tt class="PROMPT">h4: {137} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4
     Queue: 2 printable jobs
     Server: pid 17928 active
     Unspooler: pid 17929 active
     Status: opening device '/tmp/lp' at 18:14:43.921
     Rank   Owner/ID             Class Job Files            Size Time
    active papowell@h4+17920       A 17920 /tmp/hi             3 18:14:22
    2      papowell@h4+17922       A 17922 /tmp/hi,/tmp/there  9 18:14:30
    <tt class="PROMPT">h4: {138} %</tt> <tt class=
"USERINPUT"><b>lpq -ll</b></tt>
    Printer: lp@h4
     Queue: 2 printable jobs
     Server: pid 17928 active
     Unspooler: pid 17929 active
     Status: printing job 'papowell@h4+17920' at 18:14:43.921
     Status: no banner at 18:14:43.921
     Status: printing data file 'dfA017920h4.private', size 57 at 18:14:43.922
     Rank   Owner/ID             Class Job Files            Size Time
    active papowell@h4+17920       A 17920 /tmp/hi             3 18:14:22
    2      papowell@h4+17922       A 17922 /tmp/hi,/tmp/there  9 18:14:30
</pre>
      </div>
      <br>
      <br>

      <p>The <i class="EMPHASIS">Rank</i> value of the first job
      has been changed to <tt class="LITERAL">active</tt> and there
      is new <i class="EMPHASIS">Status</i> information. If we use
      <tt class="COMMAND">lpq -ll</tt> we can see the times that
      the various print operations are carried out, and details of
      their success or failure.</p>

      <p>We can also use the <b class="APPLICATION">lpc</b> command
      to see the status of a particular job. We can select jobs by
      the user name, the ID, or the job number. For example:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN2037"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {139} %</tt> <tt class=
"USERINPUT"><b>lpc stop</b></tt>
    Printer: lp@h4
    lp@h4.private: stopped
    <tt class="PROMPT">h4: {140} %</tt> <tt class=
"USERINPUT"><b>echo hi |lpr</b></tt>
    <tt class="PROMPT">h4: {141} %</tt> <tt class=
"USERINPUT"><b>echo there | lpr</b></tt>
    <tt class="PROMPT">h4: {142} %</tt> <tt class=
"USERINPUT"><b>echo test |lpr</b></tt>
    <tt class="PROMPT">h4: {143} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4  (printing disabled)
     Queue: 3 printable jobs
     Server: no server active
     Status: job 'papowell@h4+17922' removed at 18:15:13.981
     Rank   Owner/ID            Class Job Files           Size Time
    1      papowell@h4+17959      A 17959 (stdin)            3 18:23:24
    2      papowell@h4+17962      A 17962 (stdin)            6 18:23:30
    3      papowell@h4+17970      A 17970 (stdin)            5 18:23:35
    <tt class="PROMPT">h4: {144} %</tt> <tt class=
"USERINPUT"><b>lpq 17970</b></tt>
    Printer: lp@h4  (printing disabled)
     Queue: 3 printable jobs
     Server: no server active
     Status: job 'papowell@h4+17922' removed at 18:15:13.981
     Rank   Owner/ID            Class Job Files           Size Time
    3      papowell@h4+17970      A 17970 (stdin)            5 18:23:35
    <tt class="PROMPT">h4: {145} %</tt> <tt class=
"USERINPUT"><b>lpq papowell</b></tt>
    Printer: lp@h4  (printing disabled)
     Queue: 3 printable jobs
     Server: no server active
     Status: job 'papowell@h4+17922' removed at 18:15:13.981
     Rank   Owner/ID            Class Job Files           Size Time
    1      papowell@h4+17959      A 17959 (stdin)            3 18:23:24
    2      papowell@h4+17962      A 17962 (stdin)            6 18:23:30
    3      papowell@h4+17970      A 17970 (stdin)            5 18:23:35
    <tt class="PROMPT">h4: {146} %</tt> <tt class=
"USERINPUT"><b>lpq -s 17970</b></tt>
    lp@h4  1 jobs
    <tt class="PROMPT">h4: {147} %</tt> <tt class=
"USERINPUT"><b>lpq -s papowell</b></tt>
    lp@h4  3 jobs
    <tt class="PROMPT">h4: {148} %</tt> <tt class=
"USERINPUT"><b>lpq -s nobody</b></tt>
    lp@h4  0 jobs
</pre>
      </div>
      <br>
      <br>

      <p>We use <tt class="COMMAND">lpq -Pqueuename</tt> to select
      a specific print queue and <tt class="COMMAND">lpq -a</tt> or
      <tt class="COMMAND">lpq -Pall</tt> to select all queues:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN2063"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {149} %</tt> <tt class=
"USERINPUT"><b>lpc -a stop</b></tt>
    Printer: lp@h4
    lp@h4.private: stopped
    Printer: lp2@h4
    lp2@h4.private: stopped
    <tt class="PROMPT">h4: {150} %</tt> <tt class=
"USERINPUT"><b>lpc -Pall start</b></tt>
    Printer: lp@h4
    lp@h4.private: started
    Printer: lp2@h4
    lp2@h4.private: started
</pre>
      </div>
      <br>
      <br>

      <p>You can use the <b class="APPLICATION">lpc</b> command in
      <i class="EMPHASIS">interactive</i> mode:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN2072"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {151} %</tt> <tt class=
"USERINPUT"><b>lpc</b></tt>
    lpc&gt;status
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4      enabled  enabled    3    17990   17993
    lpc&gt;status all
     Printer  Printing Spooling Jobs  Server Subserver Redirect Status/(Debug)
    lp@h4      enabled  enabled    3    17990   17993
    lp2@h4     enabled  enabled    3    none    none
    lpc&gt;stop lp
    Printer: lp@h4
    lp@h4.private: stopped
    lpc&gt;start lp
    Printer: lp@h4
    lp@h4.private: started
    lpc&gt;quit
</pre>
      </div>
      <br>
      <br>

      <p>The <tt class="COMMAND">lpc topq</tt> command can be used
      to put a job (or jobs) at the head of the spool queue. This
      command is very useful when some job requires priority
      service. You can select the job by using the job number or
      the job ID.</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN2078"></a>
<pre class="SCREEN">
    <tt class="PROMPT">h4: {152} %</tt> <tt class=
"USERINPUT"><b>lpc topq lp 17970</b></tt>
    Printer: lp@h4
    lp: selected 'papowell@h4+17970'
    lp@h4.private: started
    <tt class="PROMPT">h4: {153} %</tt> <tt class=
"USERINPUT"><b>lpq</b></tt>
    Printer: lp@h4
     Queue: 3 printable jobs
     Server: pid 17999 active
     Rank   Owner/ID          Class Job Files      Size Time
    active papowell@h4+17970    A 17970 (stdin)      5 18:23:35
    1      papowell@h4+17959    A 17959 (stdin)      3 18:23:24
    2      papowell@h4+17962    A 17962 (stdin)      6 18:23:30
</pre>
      </div>
      <br>
      <br>
    </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=
          "selectingprintqueue.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=
          "jobremoval.htm" accesskey="N">Next</a></td>
        </tr>

        <tr>
          <td width="33%" align="left" valign="top">Selecting the
          Print Queue</td>

          <td width="34%" align="center" valign="top"><a href=
          "tutorial.htm" accesskey="U">Up</a></td>

          <td width="33%" align="right" valign="top">Job
          Removal</td>
        </tr>
      </table>
    </div>
  </body>
</html>