Use `systemctl try-reload-or-restart` in logrotate postrotate script `systemctl try-reload-or-restart` leverages systemd's knowledge of the daemon's main PID, eliminating the need to rely on PID files or external tools like `killall` or `pkill`. The action of remotetrx.service's `ExecReload=` sends the same signal as currently sent by `killall`, making it a suitable replacement. This ensures precise signal sending to the intended process, reducing the risk of errors in process identification. Additionally, `systemctl try-reload-or-restart` is silent by default and returns zero if the daemon is inactive. It also logs the action in the service's journal, providing a record of actions taken. The logrotate configuration snippet: # cat /etc/logrotate.d/remotetrx /var/log/remotetrx { missingok notifempty weekly create 0644 svxlink daemon postrotate killall -HUP remotetrx endscript } In the postrotate script, killall can be replaced by: /usr/bin/systemctl try-reload-or-restart remotetrx.service Because: # systemctl show -P ExecReload remotetrx.service { path=/bin/kill ; argv[]=/bin/kill -s HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } # systemctl show -P MainPID remotetrx.service 1748 # pgrep remotetrx 1748 Reproducible: Always Additional Information: svxlink-server-1.8.0-5.fc42.x86_64
The same applies to svxlink: # cat /etc/logrotate.d/svxlink-server /var/log/svxlink { missingok notifempty weekly create 0644 svxlink daemon postrotate killall -HUP svxlink endscript } In the postrotate script, killall can be replaced by: /usr/bin/systemctl try-reload-or-restart svxlink.service Because: # systemctl show -P ExecReload svxlink.service { path=/bin/kill ; argv[]=/bin/kill -s HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } # systemctl show -P MainPID svxlink.service 3418 # pgrep svxlink 3418