Sams Teach Yourself Samba in 24 Hours

ContentsIndex

Hour 8: Printers

Previous HourNext Hour

Sections in this Chapter:

 

Printer-Related Parameters

load printers

printable

lppause command

printcap name

lpq cache time

printer

lpq command

printer driver

lpresume command

printer driver file

lprm command

printer driver location

min print space

printing

postscript

queuepause command

print command

queueresume command

The following parameters affect in one way or another the way in which printer shares work. Most Samba administrators do not use many of these parameters. As always, the final list of such parameters and the final word on their function rests with the manual pages on smb.conf for the current version of Samba. You should use man smb.conf to check these parameters.

Many of the parameters listed in the following sections take variables such as %p, %j, and so on, which are expanded with printing-related information when commands are executed. Table 8.1 supplies the meaning of many of these parameters.

Table 8.1  Printer Variable Substitutions

Parameter

What It Does

%p

Replace with printer name

%j

Replace with job number

%s

Replace with spool file full pathname

%s

Replace with the spool filename (no path)

load printers

This global parameter controls whether Samba loads all printers in the printcap file for browsing.

The default value for this parameter is yes, which means that all printers in your printcap file are available for browsing by default. If you don't want this, simply use the following in the global section of your smb.conf file:

load printers = no

lppause command

This parameter specifies the command that Samba executes in order to stop printing a specific print job. It should be a command or script that takes a queue name and job number and pauses the job.

This parameter has no default unless using SysV or SOFTQ printing styles.

Please refer to the smb.conf man pages for more details.

lpq cache time

This global parameter controls how long lpq info is cached. It prevents the lpq command from being called too often. The value is expressed in seconds.

The default value for this parameter is 10 seconds.

lpq command

This parameter specifies the command that Samba executes in order to obtain printer queue status information for clients. It should be a program or script that takes a queue name and outputs printer status information.

The default value of this parameter depends on the value of the printing parameter.

lpresume command

This parameter specifies the command that Samba executes to restart or continue printing a job for clients. It should be a program or script that takes a printer name and job number to resume. This parameter does the opposite of lppause command.

This parameter has no default, unless the printing style is SysV or SOFTQ.

Please refer to the smb.conf man pages for more details.

lprm command

This parameter specifies the command that Samba executes to delete a job for clients. It should be a program or shell script that takes a printer name and job number to delete.

The default value of this parameter depends on the value of the printing parameter.

An example of using this parameter is

lprm command = /usr/bin/lprm -P%p %j

which specifies that the lprm command uses /usr/bin/lprm and is passed the queue name and the job number.

min print space

This parameter specifies the minimum amount of free disk space that must be available for clients to be able to spool print jobs. It is specified in kilobytes. A value of 0 (the default) means always spool jobs regardless of the amount of free space.

postscript

This parameter specifies that Samba should interpret print files as PostScript. Samba then adds a PostScript comment (%!) to the start of the print job, which enables you to overcome problems with PCs that insist on putting Ctrl-D characters at the start of print jobs. This confuses PostScript printers.

The default value of this parameter is false or no.

print command

This parameter specifies the command that Samba uses to spool a print job. It should be a program or script that takes a printer name and spool filename and spools the file to that printer.

The print command must contain at least one occurrence of %s or %f and can contain an occurrence of %p.

The default value of this parameter depends on the value of the printing parameter.

An example of using this parameter is

print command = /usr/local/samba/bin/localprintscrip %p %s

which specifies that a local program or shell script named localprintscript be called and passed the queue name and job number.

printable

This parameter specifies that a share is a print share, which enables clients to write spool files to the directory specified for the share. When a share is designated as printable, it is also writable by default. Any read only parameter only controls nonprinting access to the share.

The default value of this parameter is no, which means that by default, shares are not printable. That is, clients cannot connect to them as printer shares.

To make a share printable, simply add the following to the section for the share:

printable = yes

printcap name

This parameter (and its synonym printcap) is used to tell Samba the location of the printcap file used to find printers when the [printers] share is being used.

On System V systems that use lpstat to list available printers, you can set the printcap name to lpstat to obtain a list of available printers automatically.

The default value of this parameter is /etc/printcap.

An example of using this parameter is

printcap name = /etc/myprintcap

which specifies that the file /etc/myprintcap should be used when Samba needs to locate printers.

printer

This parameter tells Samba the name of the printer to send spooled jobs to when the spool file is closed by the client.

This parameter has no default value. Some examples of its use are

printer = lp
printer = hplj4

printer driver

This parameter tells Samba what driver name to give clients when they ask for the printer driver associated with a printer. It is used with auto install printer queues as discussed later this hour.

This parameter has no default value. An example of its use is

printer driver = HP LaserJet 4 Plus

printer driver file

This parameter tells Samba the location of the printer driver definition file, which is used when serving drivers to Windows 9x clients.

The file is created from a Windows 9x msprint.def file as described in the section "Automatic Printer Driver Installation."

The default value for this parameter is SAMBA_INSTALL_DIRECTORY/lib/printers.def.

printer driver location

This parameter tells Samba what share to return when clients ask for the location of printer driver files when automatically installing drivers on Windows 9x machines. This is described more fully in the section, "Automatic Printer Driver Installation."

This parameter has no default value. An example of using this parameter is

printer driver location = \\%h\printer$

printing

This parameter tells Samba the printing style to use on your server. In general, the printing style is determined at compile time, but if your system uses PLP, LPRNG, SOFTQ, or is perverse (that is, is SysV based but uses LPD), you have to set this parameter manually.

Currently, eight styles are supported:

The default value for this parameter is determined at compile time as specified above.

queuepause command

This parameter tells Samba what command to use to pause a queue. It should specify a program or script that takes a printer name and stops that queue.

The default value for this parameter depends on the printing style in effect.

queueresume command

This parameter tells Samba which command to use to resume printer queues. It should be a program or script that takes a queue name and resumes the queue.

The default value for this parameter depends on the printing style in effect.

Sams Teach Yourself Samba in 24 Hours

ContentsIndex

Hour 8: Printers

Previous HourNext Hour

Sections in this Chapter: