[cups] Auto-Clear printer queue

Michael Sweet msweet at apple.com
Mon Nov 30 08:43:00 PST 2015


Dean,

The simplest solution is to have the cron job run as root.


> On Nov 27, 2015, at 1:22 PM, Dean Montgomery <dmonty at sd73.bc.ca> wrote:
> 
> 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 
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://www.cups.org/mailman/listinfo/cups

_________________________________________________________
Michael Sweet, Senior Printing System Engineer




More information about the cups mailing list