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