Logrotate script error under systemd distributions

Hi:
I upgrade urbackup-server 2.4.x to 2.5.33 and got log rotate error. I check the new log rotate script is

 test -e /var/run/urbackupsrv.pid && kill -HUP `cat /var/run/urbackupsrv.pid` || test -e /var/run/urbackupsrv.ready && /bin/systemctl kill -s HUP --kill-who=main urbackup-server.service

however urbackupsrv didn’t create “urbackupsrv.pid” or “urbackupsrv.ready” by default.

old 2.4.x script was working fine. it was below

test -e /var/run/urbackupsrv.pid && kill -HUP `cat /var/run/urbackupsrv.pid` || /bin/systemctl kill -s HUP urbackup-server.service

so the logrotate script need to fixed. or the default systemd unit should be modified to start urbackup-server with “–pidfile” to create the pid file.

Will remove that bit again.

The problem is that I had this run once before it installed the SIGHUP handler once which killed the server on startup.

Won’t since the file gets created in 2.5.x: urbackup_backend/main.cpp at 2.5.x · uroni/urbackup_backend · GitHub

So something else is going wrong on your end.

Hi:
by default urbackupsrv will run as “urbackup” user. I don’t know if urbackup will write to “/var/run/urbackup.ready” before dropping privilege. it seems can not create the file under fedora/RHEL.

normally service will create their own directory with correct permission (eg: /var/run/urbackup/urbackup.ready").

Hello,
I am back on that issue.
I have an issue.
here syslog extract

Dec 22 00:02:09 bk3 logrotate[461629]: Failed to kill unit urbackup-server.service: Unit urbackup-server.service not loaded.
Dec 22 00:02:09 bk3 logrotate[329215]: error: error running non-shared postrotate script for /var/log/urbackup.log of '"/var/log/urbackup.log" '
Dec 22 00:02:09 bk3 systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Dec 22 00:02:09 bk3 systemd[1]: logrotate.service: Failed with result 'exit-code'.
Dec 22 02:20:02 bk3 systemd[1]: logrotate.service: Succeeded.

I think the solution is

"/var/log/urbackup.log" {
        weekly
        rotate 12
        missingok
        create 640 urbackup urbackup
        compress
        postrotate
                (test -e /var/run/urbackupsrv.pid && kill -HUP `cat /var/run/urbackupsrv.pid`) || (test -e /var/run/urbackupsrv.ready && /bin/systemctl kill -s HUP --kill-who=main urbackup-server.service)
        endscript
}

instead of current

"/var/log/urbackup.log" {
        weekly
        rotate 12
        missingok
        create 640 urbackup urbackup
        compress
        postrotate
                test -e /var/run/urbackupsrv.pid && kill -HUP `cat /var/run/urbackupsrv.pid` || test -e /var/run/urbackupsrv.ready && /bin/systemctl kill -s HUP --kill-who=main urbackup-server.service
        endscript
}

what do you think ?

Hello,
I think it would be usefull to correct code on that line