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>Dynamic Routing </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="Printcap Database " href= 12 "printcapref.htm"> 13 <link rel="PREVIOUS" title="Job Format Translation " href= 14 "translateformat.htm"> 15 <link rel="NEXT" title="Printer Load Balancing" href= 16 "loadbalance.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 "translateformat.htm" accesskey="P">Prev</a></td> 32 33 <td width="80%" align="center" valign="bottom">Chapter 34 12. Printcap Database</td> 35 36 <td width="10%" align="right" valign="bottom"><a href= 37 "loadbalance.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="DESTINATIONS">12.13. Dynamic 45 Routing</a></h1> 46 47 <p>Options used:</p> 48 49 <ul> 50 <li> 51 <p><var class="LITERAL">destinations=</var><span class= 52 "emphasis"><i class="EMPHASIS">destinations for 53 jobs</i></span></p> 54 </li> 55 56 <li> 57 <p><var class="LITERAL">router=</var><span class= 58 "emphasis"><i class="EMPHASIS">router 59 program</i></span></p> 60 </li> 61 </ul> 62 <br> 63 <br> 64 65 <p><b class="APPLICATION">LPRng</b> has the ability to route 66 a job to one or more destinations in a dynamic manner. This 67 is not the same as <span class="emphasis"><i class= 68 "EMPHASIS">load balancing</i></span>, as the destinations are 69 hard coded and not able to be changed. This is accomplished 70 by having a <var class="LITERAL">router</var> filter generate 71 a set of destinations. Here is a sample printcap entry:</p> 72 73 <div class="INFORMALEXAMPLE"> 74 <a name="AEN5994"></a> 75<pre class="SCREEN"> 76 t2|Test Printer 2 77 :sd=/var/spool/LPD/t2 78 :lf=log 79 :destinations=t1@server1,t1@server2,t1@localhost 80 :router=/usr/local/LPD/router 81</pre> 82 </div> 83 <br> 84 <br> 85 86 <p>When a job arrives at the <b class="APPLICATION">lpd</b> 87 server, the 'router' filter is invoked with the standard 88 filter options which include the user, host, and other 89 information obtained from the control file. <acronym class= 90 "ACRONYM">STDIN</acronym> is connected to a temporary copy of 91 the control file, and the CONTROL environment variable is set 92 to the value of the actual control file itself.</p> 93 94 <p>The routing filter exit status is used as follows:</p> 95 96 <ul> 97 <li> 98 <p>0 (JSUCC) - normal processing</p> 99 </li> 100 101 <li> 102 <p>37 (JHOLD) - job is held</p> 103 </li> 104 105 <li> 106 <p>any other value - job is deleted from queue</p> 107 </li> 108 </ul> 109 <br> 110 <br> 111 112 <p>The router filter writes to <acronym class= 113 "ACRONYM">STDOUT</acronym> a file specifying the destinations 114 for the job. The destinations entries in this file file have 115 the following format. Entry order is not important, but each 116 destination must end with the 'end' tag.</p> 117 118 <div class="INFORMALEXAMPLE"> 119 <a name="AEN6009"></a> 120<pre class="SCREEN"> 121 dest (destination queue) 122 copies (number of copies to be made) 123 priority (priority letter) 124 X(controlfile modifications) 125 end 126</pre> 127 </div> 128 <br> 129 <br> 130 131 <p>Example of router output:</p> 132 133 <div class="INFORMALEXAMPLE"> 134 <a name="AEN6012"></a> 135<pre class="SCREEN"> 136 dest t1@localhost 137 copies 2 138 CA 139 priority B 140 end 141 dest t2@localhost 142 CZ 143 priority Z 144 end 145</pre> 146 </div> 147 <br> 148 <br> 149 150 <p>In this example, two copies of the job will be sent to the 151 t1 and t2 spool queue servers. The Class (C letter value) and 152 job priority information will be rewritten with the indicated 153 values.</p> 154 155 <p>If routing information is specified by the router filter 156 the job will be sent to the default destination.</p> 157 158 <p><b class="APPLICATION">lpq</b> will display job 159 information in a slightly different format for multiple 160 destination jobs. For example:</p> 161 162 <p class="LITERALLAYOUT"> 163 Printer: t2@h4 'Test Printer 2' (routed/bounce queue to 't1@h2.private')<br> 164 165 Queue: 1 printable jobs in queue<br> 166 167 Rank Owner/ID Class Job Files Size Time<br> 168 169 active papowell@h4+707 A 707 /tmp/hi 3 10:04:49<br> 170 171 - actv papowell@h4+707.1 A 707 ->t1@localhost <cpy 1/2> 3 10:04:49<br> 172 173 - papowell@lprng2+707.2 A 707 ->t2@localhost 3 10:04:49</p> 174 <br> 175 <br> 176 177 <p>The routing information is displayed below the main job 178 information. Each destination will have its transfer status 179 displayed as it is transferred. By convention, the job 180 identifier of the routed jobs will have a suffix of the form 181 .N added; copies will have CN added as well. For example, 182 papowell@lprng2+707.1C2 will be the job sent to the first 183 destination, copy two.</p> 184 185 <p>Routed jobs can be held, removed, etc., just as normal 186 jobs. In addition, the individual destination jobs can be 187 manipulated as well. The LPC functionality has been extended 188 to recognize destination jobids as well as the main job id 189 for control and/or selection operations.</p> 190 191 <p>The optional <var class="LITERAL">destinations</var> entry 192 specifies the possible set of destinations that the job can 193 be sent to, and is for informational purposes only. In order 194 for <b class="APPLICATION">lpq</b> and <b class= 195 "APPLICATION">lprm</b> to find the job once it has been sent 196 to <b class="APPLICATION">lpd</b>, <b class= 197 "APPLICATION">lpq</b> and <b class="APPLICATION">lprm</b> 198 uses the list of printers in the <var class= 199 "LITERAL">destinations</var>, and iterates over list looking 200 for the job that you are interested in.</p> 201 </div> 202 203 <div class="NAVFOOTER"> 204 <hr align="LEFT" width="100%"> 205 206 <table summary="Footer navigation table" width="100%" border= 207 "0" cellpadding="0" cellspacing="0"> 208 <tr> 209 <td width="33%" align="left" valign="top"><a href= 210 "translateformat.htm" accesskey="P">Prev</a></td> 211 212 <td width="34%" align="center" valign="top"><a href= 213 "index.htm" accesskey="H">Home</a></td> 214 215 <td width="33%" align="right" valign="top"><a href= 216 "loadbalance.htm" accesskey="N">Next</a></td> 217 </tr> 218 219 <tr> 220 <td width="33%" align="left" valign="top">Job Format 221 Translation</td> 222 223 <td width="34%" align="center" valign="top"><a href= 224 "printcapref.htm" accesskey="U">Up</a></td> 225 226 <td width="33%" align="right" valign="top">Printer Load 227 Balancing</td> 228 </tr> 229 </table> 230 </div> 231 </body> 232</html> 233 234