Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [428]

By Root 3011 0

-cclass

where class is the name of a class in which the printer should be included. Any number of classes can be specified for a given printer. If you specify a nonexistent class, it will be created. The class name is limited to 14 characters.

-xprinter

removes printer from the print system. If printer is the only member of a class, then that class is also removed. Neither a printer nor a class can be removed if it has jobs queued for output. If queued jobs are keeping you from removing a printer, use the reject command to stop new jobs from being spooled. Then, use the lpmove and cancel commands to remove the existing jobs. If lpadmin -x still won’t remove the printer, follow the advice on page 727.

-rclass

removes a printer from class. The -r flag does not remove the printer; it just removes it from the class. If the specified printer is the only member of class, the class is removed.

lp will not accept requests for a new printer until it is told to do so with the accept command. See page 725.

When the flags to a command could refer to multiple objects, you can use a quoted, comma-separated list of destinations in place of a single object. For example,

# /usr/sbin/lpadmin -p"howler-lw,ralphie-lw" -ceng-printers

would put the printers howler-lw and ralphie-lw in the eng-printers class. The other printing commands accept multiple printers when it makes sense (and sometimes even when it does not). Table 23.4 summarizes the flags understood by lpadmin.

Table 23.4 lpadmin flags

a Printing is disabled by default on printers marked with lpadmin -l.

Here are some examples of lpadmin commands, with explanations of what they do:

# /usr/sbin/lpadmin -phowler-lw -v/dev/tty06 -mPostScript -cpr

This command tells the printing system that a printer to be called howler-lw is connected to /dev/tty06, that the printer should be in the class pr, and that the interface program for PostScript printers should be used. Note that lpadmin takes care of creating the spool directory with the right permissions. The command

# /usr/sbin/lpadmin -dpr

sets the system default destination to class (or printer) pr.

# /usr/sbin/lpadmin -phowler-lw -D"LaserJet named howler"4

sets the description of howler-lw.

# /usr/sbin/lpadmin -phowler-lw -rpr -cfast

removes printer howler-lw from class pr and adds it to class fast.

# /usr/sbin/lpadmin -xhowler-lw

removes howler-lw completely. This command also removes the class the printer was in if the printer was the only member of that class.

Several more examples of lpadmin command lines are shown in the Solaris and HP-UX sections starting on page 729.

lpstat: get status information


lpstat shows the status of the printing system. If executed without any arguments, it gives the status of all jobs that belong to the user who executed it. With a -p argument, lpstat gives information on the status of a particular printer. For example,

% lpstat -phowler-lw

howler-lw is now printing pr-125. enabled since Jul 4 12:25

shows the status of printer howler-lw. To determine the status of the lpsched daemon, run lpstat -r. For example,

% lpstat -r

scheduler is running

shows that everything is OK.

Table 23.5 lists the flags for lpstat.

Table 23.5 lpstat flags

a arg can be a printer, a class, or a jobid, but unfortunately not a user.

cancel: remove print jobs


cancel removes from the queue the jobs that are queued or being printed. You can invoke cancel with either a job number (determined with lpstat) or with a printer name. If you specify a printer, then the job currently being printed is canceled.

For example, cancel 576 would cancel job 576, and cancel howler-lw would cancel the job currently printing on howler-lw. The cancel command is usually owned by the pseudo-user lp with group bin and mode 6775 so that anyone can use it to cancel jobs that are obviously bogus. If someone who did not send a job cancels it, mail is sent to the job’s owner. If users abuse this privilege, set the mode of the command so that it does not run

Return Main Page Previous Page Next Page

®Online Book Reader