On Sun, Jun 5, 2016 at 12:48 AM, Michael Orlitzky <m...@gentoo.org> wrote:
>
> I'm planning on adding USE=cron to mail-filter/spamassassin to perform
> nightly updates. I have a script that works for OpenRC,
>
> https://wiki.gentoo.org/wiki/SpamAssassin#Daily_updates
>
> but I've commented where I would like to have something similar for
> systemd users. Anybody know how to do that?
>
> We can't count on systemd being installed, so we need to...
>
> 1. Test that systemd is installed.
>
> 2. Check if e.g. spamd is running (depends on #1 for the commands).
>
> 3. Reload or restart the daemon if #1 and #2 hold; or do nothing if
> one of them doesn't.

1) I've never used systemd on Gentoo but I assume that you can
co-install openrc and systemd. So you'd want to check whether systemd
is running:

[ -d /run/systemd/system ]

2) spamassassin.service is running
3) reload or restart spamassassin.service

systemctl try-reload-or-restart spamassassin.service
if sa is running, it'll reload it if sa supports a reload, otherwise
it'll restart it

systemctl try-restart spamassassin.service
if sa is running, it'll restart it

Reply via email to