Issue
- We would like to reload CUPS using something like “
service cups reload
“. This option appears to be missing from thesystemd
scripts and I can only see a restart option. - How can we get CUPS to reload it’s configuration files without restarting it?
- What will sending a
HUP
signal to CUPS do?
Resolution
Effects of HUP
Sending the CUPS scheduler (the cupsd
process) a “hangup” (HUP
) signal will cause cupsd
to do the following:
- Close any idle client connections and pause listening for new connections.
- Wait for up to 30 seconds (the default value for
ReloadTimeout
incupsd.conf
) for print jobs to complete. - Close all remaining client connections and stop listening for new connections.
- Disable all CUPS printer browsing functions. Note that in RHEL 7 and 8, this will not stop cups-browsed from performing its printer discovery and sharing functions.
- Flush and close all log, state, and cache files.
- Reload the CUPS configuration from the configuration files. During this process, all print queues defined by CUPS will be deleted and recreated.
- Start listening for new client connections and start all CUPS printer browsing functions.
- Send a notification that the server has started. This should cause cups-browsed (in RHEL 7 and 8) to recreate shared print queues maintained by cups-browsed.
- Start processing of all print jobs in the queues.
Sending HUP
to CUPS
You can sent the cupsd
process a HUP
signal to get it to reload its configuration with a command like the following:
1 |
kill -s HUP $(pidof cupsd) |
Configuring systemd to send HUP
In RHEL 7 and 8, it is also possible to modify the systemd configuration to send a HUP
signal to CUPS by by adding “ExecReload=/bin/kill -HUP $MAINPID
” to the systemd service file. To do this:
- Make a copy of the systemd service file:
12cp /usr/lib/systemd/system/cups.service /etc/systemd/system
- Edit
/etc/systemd/system/cups.service
to add the line:12ExecReload=/bin/kill -HUP $MAINPIDin the
[Service]
section of the file. - Reload the
systemd
configuration:12systemctl daemon-reload
After this, you should be able to reload CUPS by running either of the following commands:
1 2 |
systemctl reload cups.service service cups reload |