init and killscripts runlevel 0 & 6

Seth W. Klein sklein at mint.net
Sun Nov 19 17:59:35 PST 2000


Gerard Beekmans wrote:
> 
> On November 16, 2000 11:21 am, you wrote:
> > At 08:47 AM 11/16/00 -0500, Gerard Beekmans wrote:
> >
> > <snip explanation on sendsignals script>
> >
> > >I'm actually thinking about patching sysvinit not to send those signals
> > >and create a script to send those signals. What if you don't want to
> > >send TERM but something else. sendsignals is easier to modify than
> > >recompiling sysvinit every time you wan to make that change.
> >
> > I think it would be better to first run the scripts for runlevel
> > and than send the TERM & KILL signals. I makes more sense to me
> > fisrt running the 'cleanup' scripts for a runlevel and than terminate
> > any remaining processes by sending TERM & KILL
> 
> That's how it works right now. The first term&kill come from sysvinit which I
> can't seem to stop.

Those signals are init's way of stopping the processes it manages (and
others, AFAIK) when switching between runlevels. On stock LFS, the agetty's are the only such processes, everything else is handled by
the init.d system.

The reason it doesn't always work is explained in the following quote
from init(8):

When init is requested to change the runlevel, it sends the warning
signal SIGTERM to all processes that are undefined in the new runlevel.
It then waits 5 seconds before forcibly terminating these processes via
the SIGKILL signal. Note that init assumes that all these processes (and
their descendants) remain in the same process group which init originally
created for them. If any process changes its process group affiliation it
will not receive these signals. Such processes need to be terminated
separately. (End quote and thanks to the author of the man page.)

(Hence the sendsignals script.)

> the second term&kill comes from the S80sendsignals
> symlinks that's run after the K scripts brought down services in a
> 'civilized' manner

What happens when the init.d system runs (for instance) httpd in both
runlevels 2 and 3 and init (which doesn't know that) switches between
them i don't know, but i assume the "failure" explained above protects
httpd.

cheers,
sklein
-- 
sklein at mint.net                          http://members.mint.net/sklein/

-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message




More information about the lfs-dev mailing list