public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] init scripts and custom signals
@ 2006-01-09 12:32 Roy Marples
  2006-01-09 12:40 ` Henrik Brix Andersen
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Roy Marples @ 2006-01-09 12:32 UTC (permalink / raw
  To: gentoo-dev

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 <uberlord@gentoo.org>
Gentoo Linux Developer
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 12:32 [gentoo-dev] init scripts and custom signals Roy Marples
@ 2006-01-09 12:40 ` Henrik Brix Andersen
  2006-01-09 12:49   ` Roy Marples
  2006-01-09 14:22 ` Mike Frysinger
  2006-01-10  8:19 ` [gentoo-dev] baselayout 1.12 and runlevel changes Was: " Duncan
  2 siblings, 1 reply; 12+ messages in thread
From: Henrik Brix Andersen @ 2006-01-09 12:40 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

On Mon, Jan 09, 2006 at 12:32:32PM +0000, 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 <brix@gentoo.org>
Gentoo Metadistribution | Mobile computing herd

[-- Attachment #2: Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 12:40 ` Henrik Brix Andersen
@ 2006-01-09 12:49   ` Roy Marples
  0 siblings, 0 replies; 12+ messages in thread
From: Roy Marples @ 2006-01-09 12:49 UTC (permalink / raw
  To: gentoo-dev

On Monday 09 January 2006 12:40, Henrik Brix Andersen wrote:
> On Mon, Jan 09, 2006 at 12:32:32PM +0000, 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 <uberlord@gentoo.org>
Gentoo Linux Developer
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 12:32 [gentoo-dev] init scripts and custom signals Roy Marples
  2006-01-09 12:40 ` Henrik Brix Andersen
@ 2006-01-09 14:22 ` Mike Frysinger
  2006-01-09 16:05   ` Henrik Brix Andersen
                     ` (2 more replies)
  2006-01-10  8:19 ` [gentoo-dev] baselayout 1.12 and runlevel changes Was: " Duncan
  2 siblings, 3 replies; 12+ messages in thread
From: Mike Frysinger @ 2006-01-09 14:22 UTC (permalink / raw
  To: gentoo-dev; +Cc: Roy Marples

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



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 14:22 ` Mike Frysinger
@ 2006-01-09 16:05   ` Henrik Brix Andersen
  2006-01-09 16:32   ` Roy Marples
  2006-01-10 17:33   ` Roy Marples
  2 siblings, 0 replies; 12+ messages in thread
From: Henrik Brix Andersen @ 2006-01-09 16:05 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

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 <brix@gentoo.org>
Gentoo Metadistribution | Mobile computing herd

[-- Attachment #2: Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 14:22 ` Mike Frysinger
  2006-01-09 16:05   ` Henrik Brix Andersen
@ 2006-01-09 16:32   ` Roy Marples
  2006-01-09 16:59     ` Henrik Brix Andersen
  2006-01-10 17:33   ` Roy Marples
  2 siblings, 1 reply; 12+ messages in thread
From: Roy Marples @ 2006-01-09 16:32 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

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 <uberlord@gentoo.org>
Gentoo Linux Developer

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 16:32   ` Roy Marples
@ 2006-01-09 16:59     ` Henrik Brix Andersen
  0 siblings, 0 replies; 12+ messages in thread
From: Henrik Brix Andersen @ 2006-01-09 16:59 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

On Mon, Jan 09, 2006 at 04:32:28PM +0000, Roy Marples wrote:
> hostapd

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

Regards,
Brix
-- 
Henrik Brix Andersen <brix@gentoo.org>
Gentoo Metadistribution | Mobile computing herd

[-- Attachment #2: Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-dev]  baselayout 1.12 and runlevel changes  Was: init scripts and custom signals
  2006-01-09 12:32 [gentoo-dev] init scripts and custom signals Roy Marples
  2006-01-09 12:40 ` Henrik Brix Andersen
  2006-01-09 14:22 ` Mike Frysinger
@ 2006-01-10  8:19 ` Duncan
  2006-01-10 11:31   ` Roy Marples
  2 siblings, 1 reply; 12+ messages in thread
From: Duncan @ 2006-01-10  8:19 UTC (permalink / raw
  To: gentoo-dev

Roy Marples posted <200601091232.32522.uberlord@gentoo.org>, excerpted
below,  on Mon, 09 Jan 2006 12:32:32 +0000:

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

Creating a new subthread on a slightly different subtopic, tho still
initscripts/baselayout.

I've noticed that with baselayout-1.12 (not sure on <1.12 as I didn't
notice it, tho that might mean it's new behavior), changing runlevels
stops, then restarts, services that are in both runlevels.  At least RH
style initscripts simply keep running services that exist in both the old
and new runlevels, as they aren't in the kill-list, only the start-list. 
Is it intended behavior on Gentoo to force them to stop, only to restart
them on the new runlevel, when they exist in both?

If it's intended behavior, say so (an explanation of why, or pointing me
to the existing documentation that I've obviously missed, would of course
be nice as well =8^). If not, just tell me to file a bug and I will.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman in
http://www.linuxdevcenter.com/pub/a/linux/2004/12/22/rms_interview.html


-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev]  baselayout 1.12 and runlevel changes  Was: init scripts and custom signals
  2006-01-10  8:19 ` [gentoo-dev] baselayout 1.12 and runlevel changes Was: " Duncan
@ 2006-01-10 11:31   ` Roy Marples
  2006-01-10 17:11     ` [gentoo-dev] " Duncan
  0 siblings, 1 reply; 12+ messages in thread
From: Roy Marples @ 2006-01-10 11:31 UTC (permalink / raw
  To: gentoo-dev

On Tuesday 10 January 2006 08:19, Duncan wrote:
> Roy Marples posted <200601091232.32522.uberlord@gentoo.org>, excerpted
>
> below,  on Mon, 09 Jan 2006 12:32:32 +0000:
> > baelayout-1.12 is a bit more strict about things. If you ask something to
> > --stop it stops regardless.
>
> Creating a new subthread on a slightly different subtopic, tho still
> initscripts/baselayout.
>
> I've noticed that with baselayout-1.12 (not sure on <1.12 as I didn't
> notice it, tho that might mean it's new behavior), changing runlevels
> stops, then restarts, services that are in both runlevels.  At least RH
> style initscripts simply keep running services that exist in both the old
> and new runlevels, as they aren't in the kill-list, only the start-list.
> Is it intended behavior on Gentoo to force them to stop, only to restart
> them on the new runlevel, when they exist in both?

Nope, that's an error. I think I have a patch that addresses that.
I've also noticed that there is a lot of stuff in runscript.sh that doesn't 
need to be there anymore as rc now handles more of the ordering and 
dependency.

Leaving runscript.sh with just what it "needs" means it's a whole load 
lighter :)

-- 
Roy Marples <uberlord@gentoo.org>
Gentoo Linux Developer
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-dev]  Re: baselayout 1.12 and runlevel changes  Was: init scripts and custom signals
  2006-01-10 11:31   ` Roy Marples
@ 2006-01-10 17:11     ` Duncan
  2006-01-10 17:22       ` Roy Marples
  0 siblings, 1 reply; 12+ messages in thread
From: Duncan @ 2006-01-10 17:11 UTC (permalink / raw
  To: gentoo-dev

Roy Marples posted <200601101131.21791.uberlord@gentoo.org>, excerpted
below,  on Tue, 10 Jan 2006 11:31:21 +0000:

> On Tuesday 10 January 2006 08:19, Duncan wrote:
>> 
>> I've noticed that with baselayout-1.12 (not sure on <1.12 as I didn't
>> notice it, tho that might mean it's new behavior), changing runlevels
>> stops, then restarts, services that are in both runlevels.  Is it
>> intended behavior on Gentoo to force them to stop, only to restart them
>> on the new runlevel, when they exist in both?
> 
> Nope, that's an error. I think I have a patch that addresses that.

=8^)

Good.  I was afraid it was supposed to be that way, for some reason.
I'm working on and off on scripting a working suspend-to-disk for my
system (non-trivial as it's dual CPU Opteron, and that's only beginning to
be supported, so I have to figure out what I can safely continue running
and what has to be manually killed to safely suspend, then manually
restarted afterward), and am using changes in runlevels to handle killing
the network and etc, as the interrupts from it interfere with the suspend
stuff. Watching it kill and restart the stuff in both runlevels every time
was getting irritating, so I'm glad it's not /supposed/ to be that way. <g>

So that means don't bother filing a bug, then, as you are already working
on it?

> I've also noticed that there is a lot of stuff in runscript.sh that
> doesn't need to be there anymore as rc now handles more of the ordering
> and dependency.  Leaving runscript.sh with just what it "needs" means
> it's a whole load lighter :)

Always nice to be able to clear out a bunch of old cruft! =8^)

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman in
http://www.linuxdevcenter.com/pub/a/linux/2004/12/22/rms_interview.html


-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev]  Re: baselayout 1.12 and runlevel changes  Was: init scripts and custom signals
  2006-01-10 17:11     ` [gentoo-dev] " Duncan
@ 2006-01-10 17:22       ` Roy Marples
  0 siblings, 0 replies; 12+ messages in thread
From: Roy Marples @ 2006-01-10 17:22 UTC (permalink / raw
  To: gentoo-dev

On Tuesday 10 January 2006 17:11, Duncan wrote:
> So that means don't bother filing a bug, then, as you are already working
> on it?

The fix is already comitted to our svn repo.
File a bug if it still doesn't work when baselayout-1.12.0_pre14 hits portage.

Thanks

-- 
Roy Marples <uberlord@gentoo.org>
Gentoo Linux Developer
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-dev] init scripts and custom signals
  2006-01-09 14:22 ` Mike Frysinger
  2006-01-09 16:05   ` Henrik Brix Andersen
  2006-01-09 16:32   ` Roy Marples
@ 2006-01-10 17:33   ` Roy Marples
  2 siblings, 0 replies; 12+ messages in thread
From: Roy Marples @ 2006-01-10 17:33 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

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 <uberlord@gentoo.org>
Gentoo Linux Developer

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-01-10 17:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-09 12:32 [gentoo-dev] init scripts and custom signals Roy Marples
2006-01-09 12:40 ` Henrik Brix Andersen
2006-01-09 12:49   ` Roy Marples
2006-01-09 14:22 ` Mike Frysinger
2006-01-09 16:05   ` Henrik Brix Andersen
2006-01-09 16:32   ` Roy Marples
2006-01-09 16:59     ` Henrik Brix Andersen
2006-01-10 17:33   ` Roy Marples
2006-01-10  8:19 ` [gentoo-dev] baselayout 1.12 and runlevel changes Was: " Duncan
2006-01-10 11:31   ` Roy Marples
2006-01-10 17:11     ` [gentoo-dev] " Duncan
2006-01-10 17:22       ` Roy Marples

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox