在 ubuntu 中,我想使用命令行获取打印作业的状态。当我使用 lp 将作业发送到打印机时,我可以在任务栏小程序中看到打印作业的状态。例如,当我将作业发送到关闭的打印机时,我会看到显示“待处理”的作业。
但是,当我运行 lpstat -t 时,我看到的仅是以下内容:
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
如何让 lpstat 打印此作业的“待处理”或等效内容?同样,如果我有作业字符串(在本例中为 Brother_MFC-7340-15),如何查看作业是否完成或失败
答案1
man lpstat
将会展示很多东西以及:
-t Prints all status information. This
includes all the information obtained
对于队列状态,您可以尝试使用:
-W display the status of all print queues in wide format
或者
-p -l 将显示长职位列表。
“lpq” 对于打印机作业队列信息也很有用。
答案2
出色地...
lpstat -W completed
显示已完成的工作。
lpstat -W completed printerName
显示打印机“printerName”的已完成作业
lpstat 命令默认显示未完成(待处理)的作业......
lpstat:错误 - '-W' 选项后需要“完成”、“未完成”或“全部”!
因此,有一种方法可以调整命令选项以获得所需的信息。查看本地 CUPS Web 界面是否更简单http://你的ip:631- 因为这样可以提供更多的实时状态?