delete old print jobs

angelb angelb at bugarin.us
Fri May 18 11:19:54 PDT 2007


> On Thu, May 17, 2007 at 01:20:49PM -0500, Minatra, Pat H. (pminatra at hsutx.edu) wrote:
> > Amy:
> > You can use this:
> >
> > find /var/spool/cups -mtime +30 -exec rm {} \
> >
> > This would be thee modified time of the file to be GREATER than 30 days.
> > This is the way we do it.
> >
> > Make sure this does exactly what you need it to (i.e. run without '-exec
> > rm {} \'); just use the 'find /var/spool/cups -mtime +30' and you should
> > get a pretty good listing.  Your particular Unix may vary!
> >
> > HTH and have a GREAT day!
>
> Thank you for this suggestion.  I don't think restarting cups is a good
> option in our situation.  I'd rather do it with the cancel command.  Something
> like this:
>
> lpstat -o |grep -v "10 May"|while read id junk; do sudo cancel $id; done
>
> ....works for deleting any job not on May 10 but I'm looking for
> something to delete jobs older than 5 days.
>
>
> Any other ideas?

You can search for /var/spool/cups/c* and see if there is a coresponding d* for it; c00005 and d00005-001, for example.

If the c* has a corresponding d* file, you don't want to delete it;
cancel would probably better in this case.

If the c* does not have a d* file associated to it, you can safely
delete that c* file.

You can even disable PreserveJobHistory so that job information is
removed once a job is completed. And you can do the same for the data
portion by turning PreserveJobFiles off, if it's on.




More information about the cups mailing list