I have unison running under systemd to keep my local and remote NASs in sync.
The systemd config is thus:
[Unit]
Description=NAS Unision service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=nas
ExecStart=/usr/bin/unison borg
[Install]
WantedBy=multi-user.target
And in ~nas/.unison/borg.prf I have configure unison to run with:
# Keep repeating every 15 mins.
repeat=900
# Log to the file which will be rotated by logrotate.
log=true
logfile=/var/log/unison-borg.log
logrotate is configure to rotate the log once per day:
# Rotation of the Unision logs
/var/log/unison-borg.log {
dayly
rotate 7
compress
delaycompress
missingok
notifempty
create 644 nas nas
}
My issue is that unison doesn't appear to open the log file with each repeat and thus when logrotate rotates the log file unsion-borg.log.1 gets the updates.
The man file for unison states that "Sending SIGUSR1 will close the logfile; the logfile
will be re-opened (and created, if needed) automatically, to allow for log rotation."
How should I do this in systemd?
Asked by Dobbo
(124 rep)
Oct 26, 2023, 12:46 AM
Last activity: Oct 27, 2023, 01:24 AM
Last activity: Oct 27, 2023, 01:24 AM