2

In ubuntu, I'd like to get the status of a print job using the command line. When I send a job to the printer using lp, i can see the status of the print job in the taskbar applet. For instance, I see a job that says "Pending" when I send a job to a printer that is off.

However, when I run lpstat -t, all I see is the following:

scheduler is running
system default destination: Brother_MFC-7340
device for BRFAX: usb:/dev/usb/lp0
device for Brother_MFC-7340: usb://Brother/MFC-7340?serial=000G9N299107
device for MFC-7340: usb://Brother/MFC-7340?serial=000G9N299107
device for MFC7340: usb://Brother/MFC-7340?serial=000G9N299107
BRFAX accepting requests since Tue 03 Dec 2013 10:42:29 AM CST
Brother_MFC-7340 accepting requests since Fri 06 Dec 2013 04:11:28 PM CST
MFC-7340 accepting requests since Fri 06 Dec 2013 04:11:28 PM CST
MFC7340 accepting requests since Fri 06 Dec 2013 04:11:28 PM CST
printer BRFAX is idle.  enabled since Tue 03 Dec 2013 10:42:29 AM CST
    File "/usr/lib/cups/filter/brfaxfilter" has insecure permissions (0100777/uid=0/gid=0).
printer Brother_MFC-7340 disabled since Fri 06 Dec 2013 04:11:28 PM CST -
    Unplugged or turned off
printer MFC-7340 disabled since Fri 06 Dec 2013 04:11:28 PM CST -
    Unplugged or turned off
printer MFC7340 disabled since Fri 06 Dec 2013 04:11:28 PM CST -
    Unplugged or turned off
Brother_MFC-7340-14     jnankin          77824   Tue 10 Dec 2013 06:46:52 PM CST
Brother_MFC-7340-15     jnankin         305152   Tue 10 Dec 2013 07:30:13 PM CST

How do I get lpstat to print "pending" or equivalent for this job? Likewise, how do I see if a job completed or failed if I have the job string (in this case Brother_MFC-7340-15)

Josh Nankin
  • 722
  • 11
  • 27

2 Answers2

1
man lpstat

will show lots of things along with:

-t                    Prints all  status  information.  This
                      includes  all the information obtained

for the queue statused you could try to use:

 -W display the status of all print queues in wide format

OR

-p -l will show long job listings.

Also "lpq" is useful for printer job queues information.

Danila Ladner
  • 5,241
  • 21
  • 30
  • I had previously tried that, but -t doesn't really add anything useful about the jobs. I have updated the question. I get more information about the printers with -t, but nothing more detailed about the jobs (such as status). – Josh Nankin Dec 11 '13 at 15:02
  • 1
    why not discover some more options for lpstat? – Danila Ladner Dec 11 '13 at 15:18
0

Well...

lpstat -W completed shows completed jobs.

lpstat -W completed printerName shows completed jobs for printer "printerName"

The lpstat command defaults to showing not-completed (pending) jobs...

lpstat: Error - need "completed", "not-completed", or "all" after '-W' option!

So there's a way to massage the command options to get what you need. Would it not be easier to just look at the local CUPS web interface at http://your.ip:631 - As that will provide more realtime status?

ewwhite
  • 194,921
  • 91
  • 434
  • 799