These options tell Samba which Unix commands used to control and send data to the printer. The Unix commands involved are:
lpr (send to Line PRinter),
lpq (List Printer Queue),
lprm (Line printer ReMove), and optionally
lppause and
lpresume. Samba provides an option named after each of these commands, in case you need to override any of the system defaults. For example, consider:
lpq command = /usr/ucb/lpq %p
This would set the
lpq command
to use
/usr/ucb/lpq. Similarly:
lprm command = /usr/local/lprm -P%p %j
would set the Samba printer remove command to
/usr/local/lprm, and provide it the print job number using the
%j
variable.
The default values for each of these options are dependent on the value of the
printing
option.
Table 7.4 shows the default commands for each of the printing options. The most popular printing system is BSD.
Table 7.4: Default Commands for Various Printing Commands
Option |
BSD, AIX, PLP, LPRNG |
SYSV, HPUX |
QNX |
SOFTQ |
print command |
lpr -r -P%p %s |
lp -c -d%p %s; rm %s |
lp -r -P%p %s |
lp -d%p -s %s; rm %s |
lpq command |
lpq -P%p |
lpstat -o%p |
lpq -P%p |
lpstat -o%p |
lprm command |
lprm -P%p %j |
cancel %p-%j |
cancel %p-%j |
cancel %p-%j |
lppause command |
lp -i %p-%j -H hold (SYSV only) |
None |
None |
None |
lpresume command |
lp -i %p-%j -H resume (SYSV only) |
None |
None |
qstat -s -j%j -r
|
It is typically not necessary to reset these options in Samba, with the possible exception of
print
command
. This option may need to be explicitly set if your printing system doesn't have a
-r
(remove after printing) option on the printing command. For example:
/usr/local/lpr -P%p %s; /bin/rm %s
With a bit of judicious programming, these
smb.conf options can also used for debugging:
print command = cat %s >>/tmp/printlog; lpr -r -P%p %s
For example, this configuration can verify that files are actually being delivered to the Samba server. If they are, their contents will show up in the
/tmp/printlog file.
After BSD, the next most popular kind of printing system is SYSV (or System V) printing, plus some SYSV variants for IBM's AIX and Hewlett-Packard's HP-UX. These system do not have an
/etc/printcap file. Instead, the
printcap
file
option can be set to an appropriate
lpstat command for the system. This tells Samba to get a list of printers from the
lpstat command. Alternatively, you can set the global configuration option
printcap
name
to the name of a dummy
printcap file you provide. In the latter case, the file must contain a series of lines such as:
lp|print1|My Printer 1
print2|My Printer 2
print3|My Printer 3
Each line names a printer, and provides aliases for it. In this example, the first printer is called
lp
,
print1
, or
My
Printer
1
, whichever the user prefers to use. The first name will be used in place of
%p
in any command Samba executes for that printer.
Two additional printer types are also supported by Samba: LPRNG (LPR New Generation) and PLP (Public Line Printer). These are public domain and Open Source printing systems, and are used by many sites to overcome problems with vendor-supplied software. In addition, the SOFTQ and QNX realtime operating systems are supported by Samba.