Closed fmalfatto closed 10 years ago
You can use pkill instead of kill like follow if you have such utility installed:
ExecStop=/usr/bin/pkill -TERM sendmailanalyzer
or use the pid file instead:
ExecStop=/bin/kill -TERM `cat /var/run/sendmailanalyzer.pid`
or something like that. The path of the pid file is defined into sendmailanalyzer.conf with directive PID_DIR.
Or better is to restart sendmailanalyzer directly from syslog rotation. In my /etc/logrotate.d/rsyslog I have the following in the postrotate part:
postrotate
reload rsyslog >/dev/null 2>&1 || true
/bin/kill -HUP `cat /var/run/sendmailanalyzer.pid` 2>/dev/null || true
endscript
Let me know what's solves your issue.
Having pkill installed, in sendmailanalyzer.service I changed to ExecStop=/usr/bin/pkill -TERM sendmailanalyzer
and in /etc/logrotate.d/syslog I added in postrotate: /usr/bin/systemctl restart sendmailanalyzer.service > /dev/null 2>&1 || true
All is working perfectly now! Ty very much for fast and clean help!
Ok, I will drop a line about that in documentation
Small correction:
the reported line in sendmailanalyzer.service
ExecStop=/bin/kill -TERM cat /var/run/sendmailanalyzer.pid
does not work in OpenSuse 13.1, reporting "No such process" .
The correct line would be:
ExecStop=/bin/bash -c "/bin/kill -TERM /usr/bin/cat /var/run/sendmailanalyzer.pid
"
Thanks for the report, latest commit be3083f adds your patch.
Best regards,
I'm not able to stop sendmailanalyzer via "systemctl stop sendmailanalyzer.service" under opensuse 12.3.
The service definition has the following line: ExecStop=/bin/kill -TERM sendmailanalyzer
But kill needs the process id, not the process name.
I tried to change that line to ExecStop=/bin/kill -TERM $MAINPID as from systemd docs, but it does not work.
That bug make me unable to have senmailanalyze restarted after syslog rotation, and it fails every night.