• 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>Setting Up the Tutorial Configuration</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="Sample Printcap Entry" href=
14    "sampleprintcap.htm">
15    <link rel="NEXT" title="Restoring Original Configuration" href=
16    "restoring.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          "sampleprintcap.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          "restoring.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="TUTORIALCONFIG">4.3. Setting Up
45      the Tutorial Configuration</a></h1>
46
47      <p>The previous section has given a very high level view of
48      printing operations and shown a sample of some printcap
49      files. In order to do experiment with these LPRng facilities,
50      we will need to be able to modify the <tt class=
51      "FILENAME">printcap</tt> information and try various system
52      configurations.</p>
53
54      <p>We will use a series of simple printcap entries during
55      this tutorial. We will assume that the <b class=
56      "APPLICATION">LPRng</b> system is using the <tt class=
57      "FILENAME">/etc/printcap</tt> file. If your system is
58      configured to use another one, then you can make a symbolic
59      link from <tt class="FILENAME">/etc/printcap</tt> or you can
60      simply use your default <tt class="FILENAME">printcap</tt>
61      file.</p>
62
63      <p>Save the existing <tt class="FILENAME">printcap</tt> file
64      and then create a new printcap file with the contents as
65      shown below. You will need to have ROOT (superuser)
66      permissions to change the file and perform some of the
67      maintenance operations.</p>
68
69      <div class="INFORMALEXAMPLE">
70        <a name="AEN1787"></a>
71<pre class="SCREEN">
72    <samp class="PROMPT">h4: {78} #</samp> <kbd class=
73"USERINPUT">cd /etc</kbd> 
74    <samp class="PROMPT">h4: {79} #</samp> <kbd class=
75"USERINPUT">mv printcap printcap.orig</kbd>
76    <samp class="PROMPT">h4: {80} #</samp> <kbd class=
77"USERINPUT">vi printcap</kbd>
78    <kbd class="USERINPUT">#  printcap file contents:</kbd>
79    <kbd class="USERINPUT">lp:sd=/var/spool/lpd/%P</kbd>
80    <kbd class="USERINPUT"> :force_localhost</kbd>
81    <kbd class="USERINPUT"> :lp=/tmp/lp</kbd>
82    <kbd class="USERINPUT">lp2:sd=/var/spool/lpd/%P</kbd>
83    <kbd class="USERINPUT"> :force_localhost</kbd>
84    <kbd class="USERINPUT"> :lp=/tmp/lp2</kbd>
85    <samp class="PROMPT">h4: {81} #</samp> <kbd class=
86"USERINPUT">#  set permissions so everybody can read file</kbd>
87    <samp class="PROMPT">h4: {82} #</samp> <kbd class=
88"USERINPUT">chmod 666 printcap</kbd>
89</pre>
90      </div>
91      <br>
92      <br>
93
94      <p>We save the original <tt class="FILENAME">printcap</tt>
95      file and create a new one. We give the file world writable
96      permissions so that later we can modify this file without
97      needing to have root permissions. The <tt class=
98      "FILENAME">printcap</tt> file has two entries: <var class=
99      "LITERAL">lp</var> and <var class="LITERAL">lp2</var>. Each
100      print queue on the server needs a spool file to hold print
101      jobs, jobs, and the <var class="LITERAL">:sd</var> value
102      specifies its location. The <var class="LITERAL">%P</var>
103      value is replaced with the name of the printer when it is
104      used. In classical BSD operation each host has an <b class=
105      "APPLICATION">lpd</b> print spooler running on the local host
106      (we use localhost in this manual for simplicity). Files were
107      copied to spool directories on the localhost and then then
108      print spooler would send them to the destination, which could
109      be another print spooler. This meant that each localhost
110      machine had to have a print spooler and spool queue directory
111      structure. Management of this becomes very difficult in large
112      organizations. The <var class="LITERAL">force_localhost</var>
113      forces this mode of operation and means that the <b class=
114      "APPLICATION">lpd</b> server and clients must run on the same
115      host.</p>
116
117      <p>We use files for the output devices (<var class=
118      "LITERAL">:lp=</var>) so that we can see easily view the
119      output (and also to save trees). We will also need to have
120      some simple test files. Create the files using the following
121      commands.</p>
122
123      <div class="INFORMALEXAMPLE">
124        <a name="AEN1818"></a>
125<pre class="SCREEN">
126    <samp class="PROMPT">h4: {83} #</samp> <kbd class=
127"USERINPUT">cp /dev/null /tmp/lp</kbd>
128    <samp class="PROMPT">h4: {84} #</samp> <kbd class=
129"USERINPUT">cp /dev/null /tmp/lp2</kbd>
130    <samp class="PROMPT">h4: {85} #</samp> <kbd class=
131"USERINPUT">chmod 666  /tmp/lp /tmp/lp2</kbd>
132    <samp class="PROMPT">h4: {86} #</samp> <kbd class=
133"USERINPUT">echo hi &gt;/tmp/hi</kbd>
134    <samp class="PROMPT">h4: {87} #</samp> <kbd class=
135"USERINPUT">echo there &gt;/tmp/there</kbd>
136</pre>
137      </div>
138      <br>
139      <br>
140
141      <p>We will use a <span class="emphasis"><i class=
142      "EMPHASIS">dummy</i></span> <tt class=
143      "FILENAME">lpd.perms</tt> file that allows all users to do
144      anything. This is useful for testing, but dangerous in a
145      working environment.</p>
146
147      <div class="INFORMALEXAMPLE">
148        <a name="AEN1833"></a>
149<pre class="SCREEN">
150    <samp class="PROMPT">h4: {88} #</samp> <kbd class=
151"USERINPUT">#  we modify the lpd.perms to allow an ordinary user to control</kbd>
152    <samp class="PROMPT">h4: {89} #</samp> <kbd class=
153"USERINPUT">mv lpd.perms lpd.perms.orig</kbd>
154    <samp class="PROMPT">h4: {90} #</samp> <kbd class=
155"USERINPUT">echo "DEFAULT ACCEPT" &gt;lpd.perms</kbd>
156    <samp class="PROMPT">h4: {91} #</samp> <kbd class=
157"USERINPUT">chmod 666 lpd.perms</kbd>
158</pre>
159      </div>
160      <br>
161      <br>
162
163      <p>Finally we run <tt class="COMMAND">checkpc</tt> to make
164      sure that our printcap is correct and to create the necessary
165      spool directories:</p>
166
167      <div class="INFORMALEXAMPLE">
168        <a name="AEN1845"></a>
169<pre class="SCREEN">
170    <samp class="PROMPT">h4: {92} #</samp> <kbd class=
171"USERINPUT">checkpc -f -V</kbd>
172    Checking printer 'lp'
173     Checking directory: '/var/spool/lp'
174       directory '/var'
175       directory '/var/spool'
176       directory '/var/spool/lp'
177     Warning -   changing ownership '/var/spool/lp' to 1/1
178       checking 'control.lp' file
179       checking 'status.lp' file
180       checking 'status' file
181       cleaning 'status' file, 0K bytes: no truncation
182       checking 'log' file
183       cleaning 'log' file, 0K bytes: no truncation
184       checking 'acct' file
185       cleaning 'acct' file, 0K bytes: no truncation
186    Checking printer 'lp2'
187      Checking directory: '/var/spool/lp2'
188        directory '/var'
189      ....
190    <samp class="PROMPT">h4: {93} #</samp> <kbd class=
191"USERINPUT">lpc reread</kbd>
192    <samp class="PROMPT">h4: {94} #</samp> <kbd class=
193"USERINPUT">lpd</kbd>
194    <samp class="PROMPT">h4: {95} #</samp> <kbd class=
195"USERINPUT">lpq</kbd>
196    Printer: lp@h4
197       Queue: no printable jobs in queue
198</pre>
199      </div>
200      <br>
201      <br>
202
203      <p><a href="checkpc.htm"><b class=
204      "APPLICATION">Checkpc</b></a> performs consistency checks on
205      the printcap file and spool queue entries. The <tt class=
206      "COMMAND">checkpc -f</tt> (fix) option will change
207      permissions and create directories and can only be executed
208      by ROOT. <a href="checkpc.htm"><b class=
209      "APPLICATION">Checkpc</b></a> has other functions as well -
210      you can view printcap information, see default configuration
211      values, and remove junk files from spool queues with it.</p>
212
213      <p>The <tt class="COMMAND">lpc reread</tt> command sends a
214      request to the <b class="APPLICATION">lpd</b> server to
215      reread the configuration and printcap information. The <b
216      class="APPLICATION">lpd</b> command is added as insurance in
217      case your <b class="APPLICATION">lpd</b> server is not
218      running. The <tt class="COMMAND">exit</tt> command restores
219      ordinary user privileges, and the <b class=
220      "APPLICATION">lpq</b> command is used to check that the
221      server is running. Finally, we check to see that the <tt
222      class="COMMAND">lpc reread</tt> command is accepted from an
223      ordinary user.</p>
224    </div>
225
226    <div class="NAVFOOTER">
227      <hr align="LEFT" width="100%">
228
229      <table summary="Footer navigation table" width="100%" border=
230      "0" cellpadding="0" cellspacing="0">
231        <tr>
232          <td width="33%" align="left" valign="top"><a href=
233          "sampleprintcap.htm" accesskey="P">Prev</a></td>
234
235          <td width="34%" align="center" valign="top"><a href=
236          "index.htm" accesskey="H">Home</a></td>
237
238          <td width="33%" align="right" valign="top"><a href=
239          "restoring.htm" accesskey="N">Next</a></td>
240        </tr>
241
242        <tr>
243          <td width="33%" align="left" valign="top">Sample Printcap
244          Entry</td>
245
246          <td width="34%" align="center" valign="top"><a href=
247          "tutorial.htm" accesskey="U">Up</a></td>
248
249          <td width="33%" align="right" valign="top">Restoring
250          Original Configuration</td>
251        </tr>
252      </table>
253    </div>
254  </body>
255</html>
256
257