Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2002 14:21:18 +0300
From:      Petri Riihikallio <Petri.Riihikallio@Metis.fi>
To:        questions@FreeBSD.ORG, Kirk Strauser <kirk@strauser.com>
Subject:   Re: How to shut down cleanly by killing power
Message-ID:  <a05111b07b9b9ec1c1aac@[192.168.0.2]>
In-Reply-To: <bulk.28113.20020926143904@hub.freebsd.org>
References:  <bulk.28113.20020926143904@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a05111b07b9b9ec1c1aac>