Re: [gentoo-dev] init scripts and custom signals

2006-01-10 Thread Roy Marples
On Monday 09 January 2006 14:22, Mike Frysinger wrote:
> On Monday 09 January 2006 07:32, Roy Marples wrote:
> > It's been brought to my attention that dnsmasq and acpid use
> > start-stop-daemon to send custom signals such as HUP. While this works
> > with baselayout-1.11, it does not work with baselayout-1.12
>
> is this due to changes we are making in Gentoo ?  i.e. we've just been
> importing ssd from Debian for the most part and i dont really think we
> should be diverging in behavior ...
> -mike

After looking at plently of Debian scripts that use start-stop-daemon to send 
HUP's, most of them also use the --oknodo flag. Using this flag enables the 
desired behaviour in all baselayout versions. This makes sense as the 
--oknodo flag has been in start-stop-daemon for a long time whereas --signal 
was tacked on as an after though (in my eyes looking at its Debian history)

So if you just want to send a daemon a signal and keep it running you must use 
the --oknodo flag.

So in summary

start-stop-daemon --stop --signal 1 -- exec /usr/sbin/acpid
will stop acpid 

start-stop-daemon --stop --oknodo --signal 1 -- exec /usr/sbin/acpid
will just send signal 1 (HUP)

Thanks

-- 
Roy Marples <[EMAIL PROTECTED]>
Gentoo Linux Developer


pgpf6R48fuGTl.pgp
Description: PGP signature


Re: [gentoo-dev] init scripts and custom signals

2006-01-09 Thread Henrik Brix Andersen
On Mon, Jan 09, 2006 at 04:32:28PM +, Roy Marples wrote:
> hostapd

I've just updated hostapd ~ARCH to use kill.

Regards,
Brix
-- 
Henrik Brix Andersen <[EMAIL PROTECTED]>
Gentoo Metadistribution | Mobile computing herd


pgpysdQP3Z21L.pgp
Description: PGP signature


Re: [gentoo-dev] init scripts and custom signals

2006-01-09 Thread Roy Marples
On Monday 09 January 2006 14:22, Mike Frysinger wrote:
> On Monday 09 January 2006 07:32, Roy Marples wrote:
> > It's been brought to my attention that dnsmasq and acpid use
> > start-stop-daemon to send custom signals such as HUP. While this works
> > with baselayout-1.11, it does not work with baselayout-1.12
>
> is this due to changes we are making in Gentoo ?  i.e. we've just been
> importing ssd from Debian for the most part and i dont really think we
> should be diverging in behavior ...
> -mike

If so then it's undocumented behaviour - s-s-d's manpage expects --stop to 
stop the daemon. In the same way that s-s-d expects the daemon to actually be 
a daemon instead of a shell script that launches daemons.

This change was made months ago, has been in ~ARCH for months and only now 
just appears? This has been in a released baselayout since March 2005. lol

A quick grep through the tree shows the following packages using 
start-stop-daemon to send a HUP signal

capisuite
dnsmasq (has been changed to kill, but not rev bumped)
freeradius
netkit-timed
proxyper
hostapd
acpid (has been changed to kill in its ~ARCH version)

Whereas all other init scripts that send a HUP use kill or killall - examples 
are spamassassin and syslog-ng

-- 
Roy Marples <[EMAIL PROTECTED]>
Gentoo Linux Developer


pgpam2kox5mw6.pgp
Description: PGP signature


Re: [gentoo-dev] init scripts and custom signals

2006-01-09 Thread Henrik Brix Andersen
On Mon, Jan 09, 2006 at 09:22:59AM -0500, Mike Frysinger wrote:
> is this due to changes we are making in Gentoo ?  i.e. we've just been 
> importing ssd from Debian for the most part and i dont really think we should 
> be diverging in behavior ...

Both dnsmasq and acpid have been fixed to use `kill` instead - but I
wonder how many other ebuilds are "abusing" s-s-d this way...

Regards,
Brix
-- 
Henrik Brix Andersen <[EMAIL PROTECTED]>
Gentoo Metadistribution | Mobile computing herd


pgpthXq9FZkx9.pgp
Description: PGP signature


Re: [gentoo-dev] init scripts and custom signals

2006-01-09 Thread Mike Frysinger
On Monday 09 January 2006 07:32, Roy Marples wrote:
> It's been brought to my attention that dnsmasq and acpid use
> start-stop-daemon to send custom signals such as HUP. While this works with
> baselayout-1.11, it does not work with baselayout-1.12

is this due to changes we are making in Gentoo ?  i.e. we've just been 
importing ssd from Debian for the most part and i dont really think we should 
be diverging in behavior ...
-mike
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] init scripts and custom signals

2006-01-09 Thread Roy Marples
On Monday 09 January 2006 12:40, Henrik Brix Andersen wrote:
> On Mon, Jan 09, 2006 at 12:32:32PM +, Roy Marples wrote:
> > So, the question now must be, do we allow start-stop-daemon to defy
> > calling logic and NOT stop a daemon? How do we know we're not supposed to
> > stop the daemon based on a custom signal? The answer is we can't. So
> > instead of
> >
> > start-stop-daemon --stop -s HUP -p /var/run/dnsmasq.pid
> >
> > we need to write
> >
> > kill -s HUP $(< /var/run/dnsmasq.pid)
>
> ... or implement a stand-alone --signal (or -s) in start-stop-daemon,
> allowing it to be called like this:
>
> start-stop-daemon --signal HUP -p /var/run/dnsmasq.pid

Which would only work in baselayout-1.12 as the start-stop-daemon binary 
demands either a --start or --stop flag.

I've not tried it, but using --start --signal HUP should work with 
baselayout-1.12 as we don't muck around with --start. It also makes more 
sense in my eyes.

I dunno, call me old fashioned but you use the kill command to send signals to 
daemons.

Either way, the init scripts have to change.

-- 
Roy Marples <[EMAIL PROTECTED]>
Gentoo Linux Developer
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] init scripts and custom signals

2006-01-09 Thread Henrik Brix Andersen
On Mon, Jan 09, 2006 at 12:32:32PM +, Roy Marples wrote:
> So, the question now must be, do we allow start-stop-daemon to defy calling 
> logic and NOT stop a daemon? How do we know we're not supposed to stop the 
> daemon based on a custom signal? The answer is we can't. So instead of
> 
> start-stop-daemon --stop -s HUP -p /var/run/dnsmasq.pid
> 
> we need to write
> 
> kill -s HUP $(< /var/run/dnsmasq.pid)

... or implement a stand-alone --signal (or -s) in start-stop-daemon,
allowing it to be called like this:

start-stop-daemon --signal HUP -p /var/run/dnsmasq.pid

Regards,
Brix
-- 
Henrik Brix Andersen <[EMAIL PROTECTED]>
Gentoo Metadistribution | Mobile computing herd


pgp3PdrvUTohS.pgp
Description: PGP signature


[gentoo-dev] init scripts and custom signals

2006-01-09 Thread Roy Marples
Hi

It's been brought to my attention that dnsmasq and acpid use start-stop-daemon 
to send custom signals such as HUP. While this works with baselayout-1.11, it 
does not work with baselayout-1.12

The start-stop-daemon-binary has to have either a --start or --stop option. 
Now I read this as two simple statements.
1) I want to start daemon foo
2) I want to stop daemon foo

The aforementioned init scripts want option 3
3) I want to stop daemon foo with signal HUP
Which is perfectly valid. However, HUP is not a stop signal and they expect it 
to process the signal and not stop.

baelayout-1.12 is a bit more strict about things. If you ask something to 
--stop it stops regardless.

So, the question now must be, do we allow start-stop-daemon to defy calling 
logic and NOT stop a daemon? How do we know we're not supposed to stop the 
daemon based on a custom signal? The answer is we can't. So instead of

start-stop-daemon --stop -s HUP -p /var/run/dnsmasq.pid

we need to write

kill -s HUP $(< /var/run/dnsmasq.pid)

Thanks

-- 
Roy Marples <[EMAIL PROTECTED]>
Gentoo Linux Developer
-- 
gentoo-dev@gentoo.org mailing list