From owner-freebsd-questions Fri Sep 27 4:21:27 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8C6FC37B401 for ; Fri, 27 Sep 2002 04:21:25 -0700 (PDT) Received: from posti.pp.htv.fi (posti.pp.htv.fi [212.90.64.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A5E043E4A for ; Fri, 27 Sep 2002 04:21:24 -0700 (PDT) (envelope-from Petri.Riihikallio@Metis.fi) Received: from [192.168.0.2] ([212.90.71.47]) by posti.pp.htv.fi (8.11.1/8.11.1) with ESMTP id g8RBLKU06410; Fri, 27 Sep 2002 14:21:20 +0300 (EETDST) Mime-Version: 1.0 X-Sender: metis@pop.clinet.fi Message-Id: In-Reply-To: References: Date: Fri, 27 Sep 2002 14:21:18 +0300 To: questions@FreeBSD.ORG, Kirk Strauser From: Petri Riihikallio Subject: Re: How to shut down cleanly by killing power Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thank you for your thoughts. >I haven't actually done this, so take my advice with a grain of salt. > >I think that the biggest hurdle will be making sure that your filesystems >are cleanly unmounted. I would *think* that: > > umount -af > sync; sync; sync > umount -fr / > >should unmount everything except / , which it would remount as read-only. Yes, something like that should be done. There are still all the system daemons (sshd, postfix, named..) started from rc that are still running. Should I try to notify them first? How will they react when disks change to read-only? Here is a snippet of SuSe Linux halt script for apcupsd: ># Write to wtmp file before unmounting /var >$command -w > >echo "Sending all processes the TERM signal..." >killall5 -15 > >if [ "$1" = "fast" ]; then > sleep 1 >else > sleep 5 >fi > >echo "Sending all processes the KILL signal..." >killall5 -9 > >echo "Turning off swap." >sync ; sync >swapoff -a > >echo "Unmounting file systems" >umount -av > ># See if this is a powerfail situation. >if [ -f @PWRFAILDIR@/powerfail ]; then > echo "APCUPSD attempting to shutoff UPS power" > echo > @sysconfdir@/apccontrol killpower > echo >fi I believe somebody (more competent than I) has written the necessary script for FreeBSD. -- 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