On Tue, Jun 7, 2016 at 12:59 AM, Michael Orlitzky <m...@gentoo.org> wrote:
> On 06/06/2016 06:04 PM, Tom H wrote:


>> 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 ]
>
> I think the way I did this, it will be a no-op if systemd is not running
> (or if e.g. spamd is not running *under* systemd). I committed the cron
> job yesterday, so I'll hear about it if it doesn't work.

I've just looked at your script.

Do
systemctl try-restart spamassassin
and
systemctl try-restart amavisd
need "2>/dev/null" if you're booted with sysvinit+openrc but have
systemd installed like the rc-service invocations in the opposite
case? or do they fail silently?


>> 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
>
> Ah, that sounds like an improvement. It looks like amavisd.service
> supports reloading, but spamd.service doesn't. The way we do it in
> spamd.init is to send a HUP signal to the spamd process (determined from
> its PID file). Google tells me that
>
> ExecReload=/bin/kill -HUP $MAINPID
>
> should work...

It's the canonical way.

Reply via email to