1 <samba:parameter xmlns:samba="http://samba.org/common">
2 <term><anchor id="PRINTCOMMAND"/>print command (S)</term>
3 <listitem><para>After a print job has finished spooling to
4 a service, this command will be used via a <command moreinfo="none">system()</command>
5 call to process the spool file. Typically the command specified will
6 submit the spool file to the host's printing subsystem, but there
7 is no requirement that this be the case. The server will not remove
8 the spool file, so whatever command you specify should remove the
9 spool file when it has been processed, otherwise you will need to
10 manually remove old spool files.</para>
12 <para>The print command is simply a text string. It will be used
13 verbatim after macro substitutions have been made:</para>
15 <para>s, %p - the path to the spool
18 <para>%p - the appropriate printer
22 name as transmitted by the client.</para>
24 <para>%c - The number of printed pages
25 of the spooled job (if known).</para>
27 <para>%z - the size of the spooled
28 print job (in bytes)</para>
30 <para>The print command <emphasis>MUST</emphasis> contain at least
31 one occurrence of <parameter moreinfo="none">%s</parameter> or <parameter moreinfo="none">%f
32 </parameter> - the <parameter moreinfo="none">%p</parameter> is optional. At the time
33 a job is submitted, if no printer name is supplied the <parameter moreinfo="none">%p
34 </parameter> will be silently removed from the printer command.</para>
36 <para>If specified in the [global] section, the print command given
37 will be used for any printable service that does not have its own
38 print command specified.</para>
40 <para>If there is neither a specified print command for a
41 printable service nor a global print command, spool files will
42 be created but not processed and (most importantly) not removed.</para>
44 <para>Note that printing may fail on some UNIXes from the
45 <constant>nobody</constant> account. If this happens then create
46 an alternative guest account that can print and set the <link linkend="GUESTACCOUNT"><parameter moreinfo="none">guest account</parameter></link>
47 in the [global] section.</para>
49 <para>You can form quite complex print commands by realizing
50 that they are just passed to a shell. For example the following
51 will log a print job, print the file, then remove it. Note that
52 ';' is the usual separator for command in shell scripts.</para>
54 <para><command moreinfo="none">print command = echo Printing %s >>
55 /tmp/print.log; lpr -P %p %s; rm %s</command></para>
57 <para>You may have to vary this command considerably depending
58 on how you normally print files on your system. The default for
59 the parameter varies depending on the setting of the <link linkend="PRINTING">
60 <parameter moreinfo="none">printing</parameter></link> parameter.</para>
62 <para>Default: For <command moreinfo="none">printing = BSD, AIX, QNX, LPRNG
63 or PLP :</command></para>
64 <para><command moreinfo="none">print command = lpr -r -P%p %s</command></para>
66 <para>For <command moreinfo="none">printing = SYSV or HPUX :</command></para>
67 <para><command moreinfo="none">print command = lp -c -d%p %s; rm %s</command></para>
69 <para>For <command moreinfo="none">printing = SOFTQ :</command></para>
70 <para><command moreinfo="none">print command = lp -d%p -s %s; rm %s</command></para>
72 <para>For printing = CUPS : If SAMBA is compiled against
73 libcups, then <link linkend="PRINTING">printcap = cups</link>
75 submit jobs, etc. Otherwise it maps to the System V
76 commands with the -oraw option for printing, i.e. it
77 uses <command moreinfo="none">lp -c -d%p -oraw; rm %s</command>.
78 With <command moreinfo="none">printing = cups</command>,
79 and if SAMBA is compiled against libcups, any manually
80 set print command will be ignored.</para>
83 <para>Example: <command moreinfo="none">print command = /usr/local/samba/bin/myprintscript
84 %p %s</command></para>