Bug 215031 - mail-filter/postgrey-1.31 init script doesn't work with openrc and it usually appears died
|
Bug#:
215031
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: net-mail@gentoo.org
|
Reported By: mrfree@infinito.it
|
|
Component: Ebuilds
|
|
|
URL:
|
|
Summary: mail-filter/postgrey-1.31 init script doesn't work with openrc and it usually appears died
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2008-03-27 11:44 0000
|
For the problem with OpenRC replacing the --exec args with the following is
enough:
start-stop-daemon --start --quiet --background \
--exec /usr/bin/perl -- -T -w /usr/sbin/postgrey \
--${POSTGREY_ADDR} \
--daemonize \
--pidfile=${POSTGREY_PID} \
${POSTGREY_DELAY_ARG} \
${POSTGREY_OPTS} \
"${POSTGREY_TEXT_ARG}"
(I inverted the last two args as suggested in #213709 too)
When the service starts (it happens with the in-tree init script too):
* Starting Postgrey ... [ok]
* start-stop-daemon: caught an interrupt [ok]
but the daemon works well
Please, attach a unified diff next time; a whole lot easier to review any
changes.
And this breaks without openrc, suggest you find some other way of fixing the
problem than by breaking sysvinit.
If there's another perl script running start-stop-daemon dies with
'/usr/bin/perl already running'. Suggest reversion until someone comes up with
a new fix for openrc.
uhrm, I did test this with both latest (stable) baselayout and openrc ...
please give me a few more details on your setup please.
(In reply to comment #4)
> uhrm, I did test this with both latest (stable) baselayout and openrc ...
> please give me a few more details on your setup please.
>
# qlist -IvC baselayout sysvinit postgrey
mail-filter/postgrey-1.31-r1
sys-apps/baselayout-1.12.11.1
sys-apps/sysvinit-2.86-r10
All latest stable as of yesterday except for postgrey. Error only occurs if
there is another perl daemon running (I'm guessing spamd in my case, though I
haven't bothered to trace it since calling /usr/sbin/postgrey directly instead
of /usr/bin/perl resolved it for me.
Anything further I can provide that will help you verify it? I guess I could
strace it and post the log if you want, so you can see where the conflict
occurs...
I reverted the change for now. If someone has a proper fix for this ... please
post a diff ;)
Created an attachment (id=149963) [details]
postgrey-openrc-fix.patch
I suggest adding a "--name" option to start-stop-daemon
Seems to fix the problem with openrc. I have no baselayout 1.12 box to do a
non-regression test, but I do not think it hurts...
(In reply to comment #7)
> Created an attachment (id=149963) [edit] [details]
> postgrey-openrc-fix.patch
>
> I suggest adding a "--name" option to start-stop-daemon
> Seems to fix the problem with openrc. I have no baselayout 1.12 box to do a
> non-regression test, but I do not think it hurts...
>
tested on systems with both OpenRC plus baselayout 1.12 - working and committed
to CVS. Thanks for your patch!
(In reply to comment #7)
> Created an attachment (id=149963) [edit] [details]
> postgrey-openrc-fix.patch
>
> I suggest adding a "--name" option to start-stop-daemon
> Seems to fix the problem with openrc. I have no baselayout 1.12 box to do a
> non-regression test, but I do not think it hurts...
>
I know this bug is closed, but I think the more elegant solution would be to
use --pidfile with both start-stop-daemon and postgrey. After all, that's what
the PID file is for ;) Patch coming right up.
(In reply to comment #10)
> Created an attachment (id=153563) [edit] [details]
> add --pidfile to start-stop-daemon in start()
>
--pidfile is already set ...
<-- snip -->
start-stop-daemon --start --quiet --background \
--name postgrey \
--exec /usr/sbin/postgrey -- \
--${POSTGREY_ADDR} \
--daemonize \
--pidfile=${POSTGREY_PID} \
${POSTGREY_DELAY_ARG} \
${POSTGREY_OPTS} \
"${POSTGREY_TEXT_ARG}"
eend ${?}
<-- snip -->
(In reply to comment #11)
> (In reply to comment #10)
> > Created an attachment (id=153563) [edit] [details]
> > add --pidfile to start-stop-daemon in start()
> >
>
> --pidfile is already set ...
--pidfile is set as a param to postgrey, which results in the pidfile being
created in the first place. But if you also pass it to start-stop-daemon, it
checks for the pidfile/pid instead of the name passed to --exec, which solves
the mentioned problem (in a more elegant way than using --name, imho). Hence
the patch.
(In reply to comment #12)
> --pidfile is set as a param to postgrey, which results in the pidfile being
> created in the first place. But if you also pass it to start-stop-daemon, it
> checks for the pidfile/pid instead of the name passed to --exec, which solves
> the mentioned problem (in a more elegant way than using --name, imho). Hence
> the patch.
>
Missed that ... added the patch and added =postgrey-1.31-r2 to CVS. Thanks
Bernhard!