• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/LPRng/DOCS/LPRng-Reference-Multipart/
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>Routing Jobs To Print Queues</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=
14    "Load Balance Queues and Printer Pools" href="x3593.htm">
15    <link rel="NEXT" title=
16    "Job Options and the Z Control File Entry" href="x3767.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          "x3593.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          "x3767.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="AEN3694">4.18. Routing Jobs To
45      Print Queues</a></h1>
46
47      <p>A <span class="emphasis"><i class="EMPHASIS">routing
48      queue</i></span> is similar in concept to a load balance
49      queue in that it transfers a job to a (different) print
50      queue, but the job destination is chosen at the time the job
51      is submitted to the queue rather than at the time the job is
52      removed from the queue. A routing queue can modify the job
53      control file, multiple copies of the same job can be sent to
54      the same or different printers, and the job can be held,
55      rejected, or processed immediately.</p>
56
57      <p>Edit the printcap file so it have the contents indicated
58      below, create the <tt class="FILENAME">/tmp/lp2</tt> and <tt
59      class="FILENAME">/tmp/lp3</tt> files with <var class=
60      "LITERAL">0777</var> permissions. Create the <tt class=
61      "FILENAME">/tmp/router.script</tt> with the contents
62      indicated below, and give it <var class="LITERAL">0755</var>
63      (executable) permissions. Use <tt class="COMMAND">checkpc
64      -f</tt> to check the printcap, and then use <tt class=
65      "COMMAND">lpc reread</tt> to restart the <b class=
66      "APPLICATION">lpd</b> server.</p>
67
68      <div class="INFORMALEXAMPLE">
69        <a name="AEN3707"></a>
70<pre class="SCREEN">
71    # printcap
72    lp:force_localhost
73    lp:server
74      :lp=/dev/null
75      :sd=/var/spool/lpd/%P
76      :router=/tmp/router.script
77    lp2:force_localhost
78    lp2:server
79      :sd=/var/spool/lpd/%P
80      :lp=/tmp/lp2
81    lp3:force_localhost
82    lp3:server
83      :sd=/var/spool/lpd/%P
84      :lp=/tmp/lp2
85    
86    # /tmp/router.script
87    
88    #!/bin/sh
89    /bin/cat &lt;&lt;EOF
90    dest lp2
91    copies 2
92    Cred
93    end
94    dest lp3
95    end
96    EOF
97    exit 0
98</pre>
99      </div>
100      <br>
101      <br>
102
103      <p>The <tt class="FILENAME">router.script</tt> will write the
104      routing information to its <acronym class=
105      "ACRONYM">STDOUT</acronym>. For our example, we want the
106      destination <var class="LITERAL">lp2</var> to get two copies
107      of the job and we want to change the class to <var class=
108      "LITERAL">red</var>. Now run the following commands:</p>
109
110      <div class="INFORMALEXAMPLE">
111        <a name="AEN3714"></a>
112<pre class="SCREEN">
113    <samp class="PROMPT">h4: {282} %</samp> <kbd class=
114"USERINPUT">lpc stop all</kbd>
115    Printer: lp@h4
116    lp@h4.private: stopped
117    Printer: lp2@h4
118    lp2@h4.private: stopped
119    Printer: lp3@h4
120    lp3@h4.private: stopped
121    <samp class="PROMPT">h4: {283} %</samp> <kbd class=
122"USERINPUT">lpq</kbd>
123    Printer: lp@h4 (dest lp@localhost) (printing disabled) (dest lp2, lp3)
124     Queue: no printable jobs in queue
125    Printer: lp2@h4  (printing disabled)
126     Queue: no printable jobs in queue
127    Printer: lp3@h4  (printing disabled)
128     Queue: no printable jobs in queue
129    <samp class="PROMPT">h4: {284} %</samp> <kbd class=
130"USERINPUT">lpr /tmp/hi</kbd>
131    <samp class="PROMPT">h4: {285} %</samp> <kbd class=
132"USERINPUT">lpq</kbd>
133    Printer: lp@h4 (dest lp@localhost) (printing disabled) (dest lp2, lp3)
134     Queue: 1 printable job
135     Server: no server active
136     Rank   Owner/ID           Class Job Files        Size Time
137    1      papowell@h4+235       A   235 /tmp/hi         3 16:14:22
138     -          papowell@h4+235.1       -&gt;lp2 &lt;cpy 0/2&gt;
139     -          papowell@h4+235.2       -&gt;lp3
140    Printer: lp2@h4  (printing disabled)
141     Queue: no printable jobs in queue
142    Printer: lp3@h4  (printing disabled)
143     Queue: no printable jobs in queue
144</pre>
145      </div>
146      <br>
147      <br>
148
149      <p>The status reported for the spooled job indicates that the
150      job is routed to <var class="LITERAL">lp2</var>, and that two
151      copies will be sent. The <var class=
152      "LITERAL">:destinations</var> option in the printcap entry
153      causes <b class="APPLICATION">lpq</b> to display the contents
154      of the specified queues. Now execute the following
155      commands:</p>
156
157      <div class="INFORMALEXAMPLE">
158        <a name="AEN3728"></a>
159<pre class="SCREEN">
160    <samp class="PROMPT">h4: {286} %</samp> <kbd class=
161"USERINPUT">lpc start</kbd>
162    Printer: lp@h4
163    lp@h4.private: started
164    <samp class="PROMPT">h4: {287} %</samp> <kbd class=
165"USERINPUT">lpq</kbd>
166    Printer: lp@h4 (dest lp@localhost) (destinations lp2, lp3)
167     Queue: no printable jobs in queue
168     Status: job 'papowell@h4+235' removed at 16:14:37.491
169    Printer: lp2@h4  (printing disabled)
170     Queue: 2 printable jobs
171     Server: no server active
172     Rank   Owner/ID           Class Job Files        Size Time
173    1      papowell@h4+235.1C1   A   235 /tmp/hi         3 16:14:36
174    2      papowell@h4+235.1C2   A   236 /tmp/hi         3 16:14:37
175    Printer: lp3@h4  (printing disabled)
176     Queue: 1 printable job
177     Server: no server active
178     Rank   Owner/ID           Class Job Files        Size Time
179    1      papowell@h4+235.2     A   237 /tmp/hi         3 16:14:37
180    <samp class="PROMPT">h4: {288} %</samp> <kbd class=
181"USERINPUT">more /var/spool/lpd/lp2/cfA235*</kbd>
182    Hh4.private
183    Ppapowell
184    J/tmp/hi
185    Cred
186    Lpapowell
187    Apapowell@h4+235.1C1
188    D2000-06-01-16:03:25.237
189    Qlp
190    N/tmp/hi
191    fdfA235h4.private
192    UdfA235h4.private
193</pre>
194      </div>
195      <br>
196      <br>
197
198      <p>As you can see, two copies of the job has been transferred
199      to <var class="LITERAL">lp2</var> and one to <var class=
200      "LITERAL">lp3</var>, each with a different job number, If we
201      examine the control file for the jobs in the <var class=
202      "LITERAL">lp2</var> spool queue, we will find that the <var
203      class="LITERAL">C</var> or class information has been changed
204      to <var class="LITERAL">red</var>.</p>
205
206      <p>For details about all of the capabilities of the routing
207      filter, see <a href="destinations.htm">Dynamic Routing</a>.
208      Here is a summary of the information that the routing filter
209      can put into the routing file.</p>
210
211      <div class="VARIABLELIST">
212        <dl>
213          <dt>dest queue</dt>
214
215          <dd>
216            <p>Route this job to <var class="LITERAL">queue</var>.
217            The <var class="LITERAL">queue@host</var> form will
218            transfer the job to the queue on the named host.</p>
219          </dd>
220
221          <dt>copies N</dt>
222
223          <dd>
224            <p>Send N copies of this job to the destination.</p>
225          </dd>
226
227          <dt>priority C</dt>
228
229          <dd>
230            <p>Set the job priority letter to <var class=
231            "LITERAL">C</var>, where C is a single upper case
232            letter.</p>
233          </dd>
234
235          <dt>Cvalue</dt>
236
237          <dd>
238            <p>Set the control file line starting with <var class=
239            "LITERAL">C</var> to <var class=
240            "LITERAL">Cvalue</var>.</p>
241          </dd>
242        </dl>
243      </div>
244      <br>
245      <br>
246
247      <p>The exit status of the routing filter controls how the job
248      will be processed. If the exit code is JSUCC (0), then the
249      job will be processed normally, JHOLD will hold the job until
250      released, JREMOVE will remove the job, and so forth.</p>
251    </div>
252
253    <div class="NAVFOOTER">
254      <hr align="LEFT" width="100%">
255
256      <table summary="Footer navigation table" width="100%" border=
257      "0" cellpadding="0" cellspacing="0">
258        <tr>
259          <td width="33%" align="left" valign="top"><a href=
260          "x3593.htm" accesskey="P">Prev</a></td>
261
262          <td width="34%" align="center" valign="top"><a href=
263          "index.htm" accesskey="H">Home</a></td>
264
265          <td width="33%" align="right" valign="top"><a href=
266          "x3767.htm" accesskey="N">Next</a></td>
267        </tr>
268
269        <tr>
270          <td width="33%" align="left" valign="top">Load Balance
271          Queues and Printer Pools</td>
272
273          <td width="34%" align="center" valign="top"><a href=
274          "tutorial.htm" accesskey="U">Up</a></td>
275
276          <td width="33%" align="right" valign="top">Job Options
277          and the Z Control File Entry</td>
278        </tr>
279      </table>
280    </div>
281  </body>
282</html>
283
284