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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Dynamic Routing </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="Printcap Database " href=
"printcapref.htm">
<link rel="PREVIOUS" title="Job Format Translation " href=
"translateformat.htm">
<link rel="NEXT" title="Printer Load Balancing" href=
"loadbalance.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=
"translateformat.htm" accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter
12. Printcap Database</td>
<td width="10%" align="right" valign="bottom"><a href=
"loadbalance.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="DESTINATIONS">12.13. Dynamic
Routing</a></h1>
<p>Options used:</p>
<ul>
<li>
<p><tt class="LITERAL">destinations=</tt><i class=
"EMPHASIS">destinations for jobs</i></p>
</li>
<li>
<p><tt class="LITERAL">router=</tt><i class=
"EMPHASIS">router program</i></p>
</li>
</ul>
<br>
<br>
<p><b class="APPLICATION">LPRng</b> has the ability to route
a job to one or more destinations in a dynamic manner. This
is not the same as <i class="EMPHASIS">load balancing</i>, as
the destinations are hard coded and not able to be changed.
This is accomplished by having a <tt class=
"LITERAL">router</tt> filter generate a set of destinations.
Here is a sample printcap entry:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5941"></a>
<pre class="SCREEN">
t2|Test Printer 2
:sd=/var/spool/LPD/t2
:lf=log
:destinations=t1@server1,t1@server2,t1@localhost
:router=/usr/local/LPD/router
</pre>
</div>
<br>
<br>
<p>When a job arrives at the <b class="APPLICATION">lpd</b>
server, the 'router' filter is invoked with the standard
filter options which include the user, host, and other
information obtained from the control file. <span class=
"ACRONYM">STDIN</span> is connected to a temporary copy of
the control file, and the CONTROL environment variable is set
to the value of the actual control file itself.</p>
<p>The routing filter exit status is used as follows:</p>
<ul>
<li>
<p>0 (JSUCC) - normal processing</p>
</li>
<li>
<p>37 (JHOLD) - job is held</p>
</li>
<li>
<p>any other value - job is deleted from queue</p>
</li>
</ul>
<br>
<br>
<p>The router filter writes to <span class=
"ACRONYM">STDOUT</span> a file specifying the destinations
for the job. The destinations entries in this file file have
the following format. Entry order is not important, but each
destination must end with the 'end' tag.</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5956"></a>
<pre class="SCREEN">
dest (destination queue)
copies (number of copies to be made)
priority (priority letter)
X(controlfile modifications)
end
</pre>
</div>
<br>
<br>
<p>Example of router output:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5959"></a>
<pre class="SCREEN">
dest t1@localhost
copies 2
CA
priority B
end
dest t2@localhost
CZ
priority Z
end
</pre>
</div>
<br>
<br>
<p>In this example, two copies of the job will be sent to the
t1 and t2 spool queue servers. The Class (C letter value) and
job priority information will be rewritten with the indicated
values.</p>
<p>If routing information is specified by the router filter
the job will be sent to the default destination.</p>
<p><b class="APPLICATION">lpq</b> will display job
information in a slightly different format for multiple
destination jobs. For example:</p>
<p class="LITERALLAYOUT">
Printer: t2@h4 'Test Printer 2' (routed/bounce queue to 't1@h2.private')<br>
Queue: 1 printable jobs in queue<br>
Rank Owner/ID Class Job Files Size Time<br>
active papowell@h4+707 A 707 /tmp/hi 3 10:04:49<br>
- actv papowell@h4+707.1 A 707 ->t1@localhost <cpy 1/2> 3 10:04:49<br>
- papowell@lprng2+707.2 A 707 ->t2@localhost 3 10:04:49</p>
<br>
<br>
<p>The routing information is displayed below the main job
information. Each destination will have its transfer status
displayed as it is transferred. By convention, the job
identifier of the routed jobs will have a suffix of the form
.N added; copies will have CN added as well. For example,
papowell@lprng2+707.1C2 will be the job sent to the first
destination, copy two.</p>
<p>Routed jobs can be held, removed, etc., just as normal
jobs. In addition, the individual destination jobs can be
manipulated as well. The LPC functionality has been extended
to recognize destination jobids as well as the main job id
for control and/or selection operations.</p>
<p>The optional <tt class="LITERAL">destinations</tt> entry
specifies the possible set of destinations that the job can
be sent to, and is for informational purposes only. In order
for <b class="APPLICATION">lpq</b> and <b class=
"APPLICATION">lprm</b> to find the job once it has been sent
to <b class="APPLICATION">lpd</b>, <b class=
"APPLICATION">lpq</b> and <b class="APPLICATION">lprm</b>
uses the list of printers in the <tt class=
"LITERAL">destinations</tt>, and iterates over list looking
for the job that you are interested in.</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=
"translateformat.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=
"loadbalance.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Job Format
Translation</td>
<td width="34%" align="center" valign="top"><a href=
"printcapref.htm" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Printer Load
Balancing</td>
</tr>
</table>
</div>
</body>
</html>
|