My CUPS server has bad, obsolete data in /var/cups/cache. I could just blow away all the files, but I'd like to know if there is a "correct" way to clear the CUPS cache. Man pages and Google have not yielded an answer.
Asked
Active
Viewed 3.1k times
11
-
As a side note adding below lines to cupsd.conf will minimize number of files to cleanup. You can also specify them with seconds instead of "No" to keep them for limited time, e.g. 1 day. PreserveJobFiles No PreserveJobHistory No – mikijov Feb 24 '18 at 19:41
-
Not exactly pertaining to the question, but if you want to stop cups from storing a backup of every file you print in `/var/spool/cups` follow this tutorial: https://sunknudsen.com/privacy-guides/how-to-disable-cups-pinter-job-history-on-macos – IcyIcicle Nov 09 '22 at 15:56
1 Answers
15
According to CUPS documentation, the standard config places cache files in /var/spool/cups/cache and print jobs in /var/spool/cups. I'd imagine the best strategy is either of the following:
- Clear it with specific CUPS commands. Unfortunately there's not a builtin command to clear the cache; only enabling/disabling specific print queues and removing specific print jobs seem to be available.
Use lpq (to view the queues), lprm, and cancel, or the web interface, to view current jobs and remove them.cancel -ashould cancel all jobs on all queues.
If your system is hosed by defined printers and queues, deleting those objects may help. Use lpadmin or the web interface to manage defined printers. - Clear it manually, by:
- stopping CUPS (eg,
sudo service cups stop), - removing files manually, and
- restarting CUPS (eg,
sudo service cups start).
- stopping CUPS (eg,
This long thread suggests that /var/spool/cups contains completed print jobs while /var/spool/cups/tmp contains in-progress jobs. One post to that thread suggests running sudo rm -r /var/spool/cups in step 2.2 above. Steps 2.1 and 2.3 show Ubuntu commands for stopping and starting services; other OS's will vary.
If you really need to delete cache files in /var/cache/cups, you will probably need to use the manual method.
quack quixote
- 42,186
- 14
- 105
- 129
-
It's 2021 and the mentioned path is still a valid location on MacOS Big Sur (Thanks!) – tresf Mar 29 '21 at 15:09