暂停 CUPS 打印机处理队列中的作业。
cupsdisable 停止指定打印机或打印机类的作业处理,但默认仍然接收新作业,任务会留在队列中等待。它解决的是“先别打印”,不是“别收任务”;要拒绝新任务需要配合 cupsreject 或 reject。
维护场景常用 --hold 让当前作业打完再停,之后用 cupsenable --release 放行;-c 则直接取消队列中的作业。-r 可以写入暂停原因,lpstat -p 会显示 disabled 及原因,便于交接和排查。
# 暂停打印机,保留队列
sudo cupsdisable printer-a
# 等当前作业完成再暂停,并记录维护原因
sudo cupsdisable --hold -r 'replacing toner' printer-a
# 暂停并取消队列中的所有作业
sudo cupsdisable -c printer-a
cupsreject printer-a。--hold 之后恢复打印要用 cupsenable --release,只执行 cupsenable 可能留下 held 作业。lpstat -p 核对名称,远程服务器加 -h host:631。/var/log/cups/error_log 和 lpstat -p 的 state-reason。合上页面,先回答,再展开对照。
cupsdisable 之后,用户还能提交新作业吗?--hold 暂停后,怎样正确恢复打印?cupsreject。cupsenable --release 放行被挂起的作业,只执行 cupsenable 可能留下 held 作业。/var/log/cups/error_log 和 lpstat -p 的 state-reason。
小程序版
微信扫码,随时查命令