3 # shutdwn Common script for system halt/reboot.
5 # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
6 # Modified for PLD Linux by Grzegorz Stanislawski
7 # Changes: Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
9 # $Id: shutdwn,v 1.9 1999/09/04 19:49:41 waszi Exp $
12 PATH=/sbin:/bin:/usr/bin:/usr/sbin
15 NLS_DOMAIN="rc-scripts"
17 . /etc/rc.d/init.d/functions
20 [ "${BASH+bash}" = bash ] && enable kill
22 show "Sending all processes the TERM signal"
25 show "Sending all processes the KILL signal"
28 # Write to wtmp file before unmounting /var
31 # Turn off swap, then unmount file systems.
32 run_cmd "Turning off swap and accounting" swapoff -a
33 [ -x /sbin/accton ] && /sbin/accton
36 show "Unmounting file systems"; busy
37 if _ERRORS="`LANG_OLD=$LANG;LANG=C;initlog -c \"umount -a\" 2>&1;LANG=$LANG_OLD`"; then
40 deltext; fail; echo $_ERRORS
44 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
47 if [ -x /sbin/raidstop -a -f /etc/raidtab ]; then
48 # we can not use raidstop -a here because this will only stop
49 # devices listed in the default config file which is not always
50 # the case. So we look only for the active raid devices
51 if [ -f /proc/mdstat ] ; then
52 mddevs=$(grep ^md /proc/mdstat | awk '{ print $1 }')
53 for mddev in $mddevs ; do
54 run_cmd "Turning off RAID for $mddev" raidstop /dev/$mddev
58 #runcmd "Turning off RAID" /sbin/raidstop -a
61 show "Remounting remaining filesystems ro mode"; busy
62 if ( mount | awk '/ext2/ { print $3 }' | \
64 mount -n -o ro,remount $line; done ); then