[cups] Auto-Clear printer queue

Dean Montgomery dmonty at sd73.bc.ca
Fri Nov 27 10:22:37 PST 2015


I maintain CUPS servers for over 50 schools/buildings.

When a printer goes offline due to paper/ink/power sometimes the jobs will stay in the queue overnight.  The default Error policy for all printers is abort-job. 

I'm trying to auto clear out these jobs but I've discovered that scripting `lprm` or `cancel` from a cron job fails as cron can not type in the cups password:

  Password for root on 10.87.0.1? cancel: purge-jobs failed: Unauthorized
    or
  Password for root on 10.98.0.1? lprm: Unauthorized

The command line tools are adhering to cupsd.conf which is setup so students can't cancel the report-card or newsletter jobs.
  <Limit Cancel-Job>
    Order deny,allow
    Require user @OWNER @SYSTEM
  </Limit>


How do I auto clear out the printer queues at night without compromising regular "cancel job" security or putting root's password into an `expect` script?


I'm almost considering a nasty-hack-night-cron script that would:
 1) stops cups
 2) replace cupsd.conf with a temporary cupsd.conf with no limits on Cancel-Job Purge-Jobs.
 3) start cups
 4) cancel the jobs
 5) stop cups
 6) restore original cupsd.conf
 7) start cups


-- 


Dean Montgomery 
Network Support Tech./Programmer 
School District #73 



More information about the cups mailing list