1 |
El dom, 05-06-2016 a las 09:37 -0400, Michael Orlitzky escribió: |
2 |
> On 06/05/2016 03:23 AM, J. García wrote: |
3 |
> > |
4 |
> > I run systemd , but I have not tested your script, as of now I'm |
5 |
> > not |
6 |
> > using spamassassin, but I will at some time in near future; but |
7 |
> > looking |
8 |
> > at the script, I see some problems, you run the OpenRC restart |
9 |
> > commands |
10 |
> > even if systemd is available, further it doesn't know which one is |
11 |
> > running, as both can be installed(And are installed if using |
12 |
> > systemd), |
13 |
> That's what the "/etc/init.d/spamd status" command is meant to check. |
14 |
> The "... status" will only return success if you are running spamd |
15 |
> via |
16 |
> openrc. Likewise, as I understand it (but haven't tested), the |
17 |
> "systemctl try-restart spamassassin" command will only work if you |
18 |
> are |
19 |
> *using* systemd and the spamassassin service is running. They should |
20 |
> be |
21 |
> harmless otherwise. |
22 |
> |
23 |
It works, and is harmless as you say, but since I'm not running OpenRC, |
24 |
it prints a warning to stderr about openrc not running, at least I find |
25 |
that a bit annoying, that's why I suggested to check which one is |
26 |
running as PID 1. I don't know if systemctl prints anything in the |
27 |
other case(OpenRC running, and systemd installed) but you can run it |
28 |
with -q to be silent: |
29 |
The following message is print every time /etc/init.d/{spamd,amavisd} |
30 |
status is run, e.g.: |
31 |
|
32 |
# /etc/init.d/spamd status |
33 |
* You are attempting to run an openrc service on a |
34 |
* system which openrc did not boot. |
35 |
* You may be inside a chroot or you may have used |
36 |
* another initialization system to boot this system. |
37 |
* In this situation, you will get unpredictable results! |
38 |
* If you really want to do this, issue the following command: |
39 |
* touch /run/openrc/softlevel |
40 |
|
41 |
IMHO, that is junk not needed in logs that might be generated from your |
42 |
script, but redirecting any output from /etc/init.d/$SERVICE status to |
43 |
/dev/null. |