Tuesday, May 27, 2008

CUPS printer commands

More information can be found on the CUPS website: http://www.cups.org/documentation.php

Basic CUPS commands

cancel

Allows you to cancel all jobs, all jobs on a specific printer or individual jobs

lpq

show printer queue status on specific printer, or all printers

lpq -P printername

lists all queued jobs on target printer

accept

accept jobs sent to a destination

reject

reject jobs sent to a destination

lp

show printer queue status on specific printer, or all printers

lpq -P printername

lists all queued jobs on target printer

lp

submits files for printing or alters a pending job

lpadmin

configure cups printers and classes

lpadmin -x printername

deletes target printer

lpinfo

lists the available devices or drivers known to the CUPS server

lpmove

moves the specified job or all jobs from source to destination

lpoptions

display or set printer options and defaults

lprm

cancels print jobs that have been queued for printing

lpstat

displays status information about the current classes, jobs, and printers

lpstat -t

Lists all printers and all status information

lpstat -a

Lists all printers and accepting state

Printer hangs up on a job

  1. Turn off the printer
  2. Ssh into the print server
  3. lpq -P PrinterName

This will list all jobs queued on the hung printer. In most cases, deleting all submitted jobs is safest

  1. Cancel -a PrinterName

Cancels all submitted jobs on target printer

  1. Restart printer

Check that jobs are printing

Clearing Boelter Lab print queues daily

  1. cancel -a `lpstat -t | grep disabled | awk '{print $2}'`

This will list all printers that are currently disabled, and cancel queued jobs on those printers

  1. /usr/bin/enable `lpstat -t | grep disabled | awk '{print $2}'`

This will re-enable the stopped print queues

  1. lpstat -t | grep disabled | awk '{print $2}'

This checks to see that all printers are re-enabled. Should return nothing.

Remove printers from client computer

  1. lpadmin -x `lpstat -a | awk '{printf $1 " "}'`

Lists all printers on client, sorts the printer names into a string, then issues lpadmin -x (removal) command to each printer. Command only deletes a printer at a time right now.

No comments: