Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [429]

By Root 3047 0
setuid.

accept and reject: control spooling


If a printer will be unavailable for a long time (for example, because of a hardware failure), spooling to that device should be disabled so that users who are unaware of the situation do not fill up the queue. Disable spooling with the reject command. For example, the following command would cause lp to reject requests for howler-lw:

# /usr/sbin/reject -r"howler-lw will be down until Tuesday" howler-lw

The -r flag is optional, but it is a nice way to tell users the reason why the printer is rejecting requests. When someone tries to print a file, lp displays your message:

% /usr/bin/lp -dhowler-lw myfile

lp: cannot accept requests for destination "howler-lw"

-- howler-lw will be down until Tuesday

accept printer tells lp to begin accepting requests for printer. You must run accept once for each new printer added with lpadmin because new printers are configured to reject requests by default. You can give accept and reject a class name instead of a destination name to enable or disable spooling for an entire class.

enable and disable: control printing


The disable command tells lpsched to stop sending jobs to a particular printer. Unlike reject, disable does not stop lp from queuing jobs for the printer. However, queued jobs will not be output until the printer is reenabled with enable. disable does not normally abort printing of the current job, but the -c option requests this behavior. Like reject, disable supports a -r flag that allows you to explain why a printer is disabled.

For example, the command

# /bin/disable -r"Being cleaned, back in 5 minutes" howler-lw

disables printing on howler-lw. To restart printing, type:

# /bin/enable howler-lw

lpmove: transfer jobs


It’s sometimes necessary to move jobs queued for one printer or class to another printer. You accomplish this feat with lpmove, which you run with a list of jobids and the name of a new printer. For example, the command

# /usr/sbin/lpmove howler-lw-324 howler-lw-325 anchor-lj

would move the jobs numbered 324 and 325 from the queue for howler-lw to the queue for anchor-lj. You can also give lpmove a printer or class as a source. For example, the command

# /usr/sbin/lpmove howler-lw anchor-lj

moves all jobs queued for howler-lw to the queue for anchor-lj. When lpmove is used in this way, it has the side effect of executing a reject on the printer of origin. In the preceding example, lp would no longer accept requests for howler-lw.

By design, the HP-UX version of lpmove cannot be used when lpsched is running. Run lpshut first.

Interface programs


An interface program must take information from a file that lpsched specifies, format it, and send the formatted data to its standard output. The interface program is also responsible for setting the correct modes on its output device and for generating headers and trailers if they are desired. Interface programs are usually shell scripts, but they can be executable binaries, too.

lpsched calls interface programs with the following arguments:

jobid user title copies options file [file ...]

Where:

• jobid is the job identification that is assigned by lp

• user is the user to whom the job belongs

• title is an optional title supplied by the user

• copies is the number of copies to print

• options are user-supplied options

• The files are full pathnames of files to be printed

All of the arguments are supplied each time the interface program is executed, but some of them may be null strings. The interface program gets its standard input from /dev/null, and both standard output and standard error are directed to the destination device as specified by lpadmin -v.

Unlike the BSD system, which uses different interface programs for different file formats, SysV requires interface programs to handle all the kinds of data that the printer can accept (and to fail nicely if unrecognizable input is received). For this reason, interface programs are usually just shell scripts that process their

Return Main Page Previous Page Next Page

®Online Book Reader