From owner-freebsd-questions Wed Jan 7 07:01:52 1998 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id HAA06136 for questions-outgoing; Wed, 7 Jan 1998 07:01:52 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from mail.netcetera.dk (root@sleipner.netcetera.dk [194.192.207.2]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id HAA06105 for ; Wed, 7 Jan 1998 07:01:46 -0800 (PST) (envelope-from leifn@image.dk) Received: (from uucp@localhost) by mail.netcetera.dk (8.8.8/8.8.8) with UUCP id PAA17170 for freebsd-questions@freebsd.org; Wed, 7 Jan 1998 15:59:04 +0100 Received: by swimsuit.swimsuit.roskildebc.dk (0.99.970109) id AA02971; 07 Jan 98 15:46:31 +0100 From: leifn@image.dk (Leif Neland) Date: 07 Jan 98 13:01:48 +0100 Subject: Re: /etc/shutdown.d not in bsd Message-ID: References: <199801021421.GAA04109@hub.freebsd.org> <199801050713.BAA00324@detlev.UUCP> Organization: Fidonet: UNIX-sysadm søger job To: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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