Date: Fri, 27 Sep 2002 22:48:13 +0300 From: Petri Riihikallio <Petri.Riihikallio@Metis.fi> To: questions@FreeBSD.ORG Subject: Re: How to shut down cleanly by killing power Message-ID: <a05111b0bb9ba664541e1@[192.168.0.2]>
next in thread | raw e-mail | index | archive | help
Thanks for your reply! >"sync" is pretty much useless, it doesn't buy you anything. >Particularly, it won't mark your filesystems clean (so fsck >will still have to run on the next boot), and it does not >guarantee that there's no unwritten data left in memory. Yes, this I found out by testing. Still many shutdown scripts include "sync ; sync ; sync" as a mantra. >No. Upon shutdown, the scripts will be executed in reverse >ASCII order. You should rather call it something like >"%%%whatever". There's never a guarantee, however, that >some clever port tries to install a "%%%%%%foo" script in >order to get there first ... Thanks for pointing that out! 'man rc' says just: "The scripts within each directory are executed in lexicographical order." I know the source IS the doc, but it is so slow way to find something, when you don't know what your looking for. >So, maybe the best thing is to add your script at the end >of /etc/rc.shutdown directly. > - - - - >Yes, exactly. This should do: > >umount -f -A >mount -u -o ro / >mount -o ro /usr OK. Any need for 'mount -f -u -o ro /' ? (The -f forces the switch to ro even if files are open for writing) Is there any reason to signal the system daemon processes (syslog, sshd, adjkrntz & co)? The Linux scripts do this with killall5. It sends a signal to all processes except the processes in its own session, so it won't kill the shell that is running the script it was called from. >That's documented in /usr/src/sbin/init/init.c. :-] "The source IS the doc" I studied /usr/src/sys/kern/kern_shutdown.c but I couldn't find where the scripts were called. It is init calling the scripts and then calling kern_shutdown. -- Cheers, Petri Metis / Petri Riihikallio GSM: +358 400 505 939 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a05111b0bb9ba664541e1>