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: Mon, 06 Jun 2016 22:04:15
Message-Id: CAOdo=SywNHXEgkO5T8Rf8qiL5EOWWqWupHV3HK+O_tVwp2bXJA@mail.gmail.com
In Reply to: [gentoo-user] Safe systemd "reload" command by Michael Orlitzky
1 On Sun, Jun 5, 2016 at 12:48 AM, Michael Orlitzky <mjo@g.o> wrote:
2 >
3 > I'm planning on adding USE=cron to mail-filter/spamassassin to perform
4 > nightly updates. I have a script that works for OpenRC,
5 >
6 > https://wiki.gentoo.org/wiki/SpamAssassin#Daily_updates
7 >
8 > but I've commented where I would like to have something similar for
9 > systemd users. Anybody know how to do that?
10 >
11 > We can't count on systemd being installed, so we need to...
12 >
13 > 1. Test that systemd is installed.
14 >
15 > 2. Check if e.g. spamd is running (depends on #1 for the commands).
16 >
17 > 3. Reload or restart the daemon if #1 and #2 hold; or do nothing if
18 > one of them doesn't.
19
20 1) I've never used systemd on Gentoo but I assume that you can
21 co-install openrc and systemd. So you'd want to check whether systemd
22 is running:
23
24 [ -d /run/systemd/system ]
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 systemctl try-restart spamassassin.service
34 if sa is running, it'll restart it

Replies

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