[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kill -1 in boot process



In article <[🔎] 20011022095337.D26EA3834A7@lyta.coker.com.au>,
Russell Coker  <russell@coker.com.au> wrote:
>It seems that daemons started from /etc/init.d/rcS.d get sent signal 1 before 
>the system goes to multi-user mode.
>When did it start doing this?  I recall that daemons used to not get such a 
>signal...
>Why is this happening?

In newer versions of sysvinit the sysinit and wait type entries
now have /dev/console as controlling terminal. This is so that
you have a functioning "session" when starting an interactive shell.
I.e. Control-C now works ;)

If a daemon doesn't disconnect from the terminal properly (i.e. closes
stdin/stdout/sterr and calls setsid()) then the kernel might send
it a SIGHUP signal when the existing session ends.

So it could possibly be a bug in the daemon in that it doesn't
daemonize correctly.

A shell script that gets backgrounded somehow (i.e. run as a daemon)
should do this to correctly detach from its tty:


exec </dev/null >/dev/null 2>&1
setsid


Mike.
-- 
"Only two things are infinite, the universe and human stupidity,
 and I'm not sure about the former" -- Albert Einstein.



Reply to: