<div dir="ltr"><div dir="ltr">On Wed, Sep 30, 2020 at 11:24 AM Ulrich Windl <<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de">Ulrich.Windl@rz.uni-regensburg.de</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
<br>
I have a problem with logrotate: My postrotate command does not seem to send a HUP signal. However the files are rotated.<br>
I'm using this (not preferred way, I know):<br>
<br>
...<br>
postrotate<br>
test -s '/var/run/iotwatch-LOC1/iotwatch-LOC1.pid' &&<br>
systemctl kill -s HUP --kill-who=main iotwatch@LOC1.service <br>
endscript<br>
...<br>
<br>
I've verified that the PID file exists (just rebooted the server a few minutes ago):<br>
# ll /var/run/iotwatch-LOC1/iotwatch-LOC1.pid<br>
-rw-r--r-- 1 root root 5 Sep 30 10:07 /var/run/iotwatch-LOC1/iotwatch-LOC1.pid<br></blockquote><div><br></div><div>Do you need to check for it in the first place?</div><div><br></div><div>Does the same command work from interactive CLI?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
My service would log the arrival of any HUP signal, but it didn't. Also in syslog I could not find any error message related to "systemctl kill".<br>
What might be wrong?<br>
<br>
My service is using ExecStartPre, ExecStartPost, and ExecStart. Could systemd be confused about "--kill-who=main" then?</blockquote><div><br></div><div>--kill-who=main means the signal will be sent to the "main" process that was started from ExecStart (shown as "Main PID:" in systemctl status).</div><div><br></div><div>The more preferred way of doing this is to have "ExecReload=/bin/kill -HUP $MAINPID" and then `systemctl reload foo.service`.</div><div><br>Sending HUP to ExecStartPre and ExecStartPost doesn't make sense, since those are supposed to be short-running commands – they are not allowed to actually *have* daemons.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>