On Sat, Jun 4, 2016 at 6:48 PM, 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. >
Couldn't you just check for the existence of systemctl, and if it exists call "systemctl try-restart spamd". That will only work if systemd is running and spamd is running. I'm sure you can accomplish the same via dbus as well. -- Rich