Merge 86d8954318
into 0d3aa55231
This commit is contained in:
commit
789f957d51
1 changed files with 11 additions and 21 deletions
|
@ -2,7 +2,7 @@
|
|||
Title: How to disable CUPS printer job history on macOS
|
||||
Description: Learn how to disable CUPS printer job history on macOS.
|
||||
Author: Sun Knudsen <https://github.com/sunknudsen>
|
||||
Contributors: Sun Knudsen <https://github.com/sunknudsen>
|
||||
Contributors: Sun Knudsen <https://github.com/sunknudsen>, Carl P. Corliss <https://github.com/rabbitt>
|
||||
Reviewers:
|
||||
Publication date: 2022-10-29T13:05:18.112Z
|
||||
Listed: true
|
||||
|
@ -34,7 +34,7 @@ sudo mkdir -p /usr/local/sbin
|
|||
sudo chown ${USER}:admin /usr/local/sbin
|
||||
```
|
||||
|
||||
### Step 3: create `cups.sh` script
|
||||
### Step 3: create `cups.sh` script (see CUPS [docs](https://www.cups.org/doc/man-cupsd.conf.html))
|
||||
|
||||
```shell
|
||||
cat << "EOF" > /usr/local/sbin/cups.sh
|
||||
|
@ -42,15 +42,11 @@ cat << "EOF" > /usr/local/sbin/cups.sh
|
|||
|
||||
set -e
|
||||
|
||||
if grep -qe '^PreserveJobHistory Off$' /etc/cups/cupsd.conf; then
|
||||
if cupsctl | grep --quiet PreserveJobHistory=no; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "PreserveJobHistory Off" | sudo tee -a /etc/cups/cupsd.conf
|
||||
|
||||
sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
|
||||
|
||||
sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
|
||||
cupsctl MaxJobTime=5m PreserveJobFiles=no PreserveJobHistory=no
|
||||
EOF
|
||||
```
|
||||
|
||||
|
@ -62,6 +58,8 @@ chmod +x /usr/local/sbin/cups.sh
|
|||
|
||||
### Step 5: create `local.cups.plist` launch daemon
|
||||
|
||||
> Heads-up: used to make sure user-defined config persists macOS updates.
|
||||
|
||||
```shell
|
||||
cat << "EOF" | sudo tee /Library/LaunchDaemons/local.cups.plist
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -91,32 +89,24 @@ EOF
|
|||
|
||||
## Want things back the way they were before following this guide? No problem!
|
||||
|
||||
### Step 1: delete `PreserveJobHistory Off` line from `cupsd.conf`
|
||||
|
||||
```shell
|
||||
sudo sed -i "" "/PreserveJobHistory Off/d" /etc/cups/cupsd.conf
|
||||
```
|
||||
|
||||
### Step 2: delete `cups.sh` script
|
||||
### Step 1: delete `cups.sh` script
|
||||
|
||||
```shell
|
||||
sudo rm /usr/local/sbin/cups.sh
|
||||
```
|
||||
|
||||
### Step 3: delete `local.cups.plist` launch daemon
|
||||
### Step 2: delete `local.cups.plist` launch daemon
|
||||
|
||||
```shell
|
||||
sudo rm /Library/LaunchDaemons/local.cups.plist
|
||||
```
|
||||
|
||||
### Step 4: reload CUPS
|
||||
### Step 3: revert user-defined config to CUPS defaults
|
||||
|
||||
```shell
|
||||
sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
|
||||
|
||||
sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
|
||||
cupsctl MaxJobTime= PreserveJobFiles= PreserveJobHistory=
|
||||
```
|
||||
|
||||
### Step 5: reboot
|
||||
### Step 4: reboot
|
||||
|
||||
👍
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue