Gentoo Archives: gentoo-user

From: Tom H <tomh0665@×××××.com>
To: Gentoo User <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Safe systemd "reload" command
Date: Tue, 07 Jun 2016 10:17:30
Message-Id: CAOdo=Sx4N7494TZFk+N=O886kag9CshEk3gn7ELDwHn2fYPM9Q@mail.gmail.com
In Reply to: Re: [gentoo-user] Safe systemd "reload" command by Michael Orlitzky
1 On Tue, Jun 7, 2016 at 12:59 AM, Michael Orlitzky <mjo@g.o> wrote:
2 > On 06/06/2016 06:04 PM, Tom H wrote:
3
4
5 >> 1) I've never used systemd on Gentoo but I assume that you can
6 >> co-install openrc and systemd. So you'd want to check whether systemd
7 >> is running:
8 >>
9 >> [ -d /run/systemd/system ]
10 >
11 > I think the way I did this, it will be a no-op if systemd is not running
12 > (or if e.g. spamd is not running *under* systemd). I committed the cron
13 > job yesterday, so I'll hear about it if it doesn't work.
14
15 I've just looked at your script.
16
17 Do
18 systemctl try-restart spamassassin
19 and
20 systemctl try-restart amavisd
21 need "2>/dev/null" if you're booted with sysvinit+openrc but have
22 systemd installed like the rc-service invocations in the opposite
23 case? or do they fail silently?
24
25
26 >> 2) spamassassin.service is running
27 >> 3) reload or restart spamassassin.service
28 >>
29 >> systemctl try-reload-or-restart spamassassin.service
30 >> if sa is running, it'll reload it if sa supports a reload, otherwise
31 >> it'll restart it
32 >
33 > Ah, that sounds like an improvement. It looks like amavisd.service
34 > supports reloading, but spamd.service doesn't. The way we do it in
35 > spamd.init is to send a HUP signal to the spamd process (determined from
36 > its PID file). Google tells me that
37 >
38 > ExecReload=/bin/kill -HUP $MAINPID
39 >
40 > should work...
41
42 It's the canonical way.

Replies

Subject Author
Re: [gentoo-user] Safe systemd "reload" command Michael Orlitzky <mjo@g.o>