El dom, 05-06-2016 a las 09:37 -0400, Michael Orlitzky escribió:
> On 06/05/2016 03:23 AM, J. García wrote:
> > 
> > I run systemd , but I have not tested your script, as of now I'm
> > not
> > using spamassassin, but I will at some time in near future; but
> > looking
> > at the script, I see some problems, you run the OpenRC restart
> > commands
> > even if systemd is available, further it doesn't know which one is
> > running, as both can be installed(And are installed if using
> > systemd),
> That's what the "/etc/init.d/spamd status" command is meant to check.
> The "... status" will only return success if you are running spamd
> via
> openrc. Likewise, as I understand it (but haven't tested), the
> "systemctl try-restart spamassassin" command will only work if you
> are
> *using* systemd and the spamassassin service is running. They should
> be
> harmless otherwise.
> 
It works, and is harmless as you say, but since I'm not running OpenRC,
it prints a warning to stderr about openrc not running, at least I find
that a bit annoying, that's why I suggested to check which one is
running as PID 1. I don't know if systemctl prints anything in the
other case(OpenRC running, and systemd installed) but you can run it
with -q to be silent:
The following message is print every time /etc/init.d/{spamd,amavisd}
status is run, e.g.:

 # /etc/init.d/spamd status
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel 

IMHO, that is junk not needed in logs that might be generated from your
script, but redirecting  any output from /etc/init.d/$SERVICE status to
/dev/null.

Reply via email to