Date: 07 Jan 98 13:01:48 +0100 From: leifn@image.dk (Leif Neland) To: freebsd-questions@freebsd.org Subject: Re: /etc/shutdown.d not in bsd Message-ID: <ab8_9801071546@swimsuit.swimsuit.roskildebc.dk> References: <199801021421.GAA04109@hub.freebsd.org> <199801050713.BAA00324@detlev.UUCP>
next in thread | previous in thread | raw e-mail | index | archive | help
At 05 Jan 98 08:13:58 Joel Ray Holveck wrote regarding Re: /etc/shutdown.d not in bsd >>> Being used to /etc/shutdown.d in SysV, I can't understand BSD can >>> do without it. >> Because the system will shut them down for you. When the system is >> halted, every process is sent a SIGTERM (signal 15). most >> processes will then exit gracefully. (Some evil ones that mask >> SIGTERM then get a SIGKILL to finish them off). JR> He means to ensure that, for instance, a process which dies with JR> runtime summaries is killed before syslogd; a client which send a JR> shutdown message to its server is killed before PPP, etc. JR> JR> This is done by /etc/rc.shutdown, as mentioned in init(8). But here comes the nasty thing: halt/reboot does NOT signal init, so init doesn't get a chance to execute /etc/rc.shutdown. halt/reboot just kills everything in sight itself. When doint kill -INT 1 or kill -TERM 1, init runs /etc/rc.shutdown, and reboots or goes into singleuser mode. I have modified init.c, so kill -USR1 halts, and kill -USR2 powerdowns. I have also modified reboot.c so it instead of killing processes itself, it just signals init. As init syncs, I have kept the old routines for halt/reboot -q and -n. I will now cvsup the original files (I _have_ saved my versions!) to make diff's. I have even changed the manpages... Oh, and I have for my own sysV-fondness added a define to allow the SysV-way of changing states: init 0 to halt, init 1 to singleuser, init 6 to reboot, init q to re-read /etc/ttys. But that's probably too nasty... Leif Neland leifn@image.dk --- |Fidonet: Leif Neland 2:234/49 |Internet: leifn@image.dk
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ab8_9801071546>