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>
11 PATH=/sbin:/bin:/usr/bin:/usr/sbin
13 . /etc/rc.d/init.d/functions
16 [ "${BASH+bash}" = bash ] && enable kill
18 show "Sending all processes the TERM signal "
21 show "Sending all processes the KILL signal "
24 # Write to wtmp file before unmounting /var
27 # Turn off swap, then unmount file systems.
28 run_cmd "Turning off swap and accounting" swapoff -a
29 [ -x /sbin/accton ] && /sbin/accton
30 run_cmd "Unmounting file systems" umount -a
31 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
34 if [ -x /sbin/raidstop -a -f /etc/raidtab ]; then
35 # we can not use raidstop -a here because this will only stop
36 # devices listed in the default config file which is not always
37 # the case. So we look only for the active raid devices
38 if [ -f /proc/mdstat ] ; then
39 mddevs=$(grep ^md /proc/mdstat | awk '{ print $1 }')
40 for mddev in $mddevs ; do
41 run_cmd "Turning off RAID for $mddev" raidstop /dev/$mddev
45 #runcmd "Turning off RAID" /sbin/raidstop -a
48 show "Remounting remaining filesystems ro mode"; busy
49 if (mount | awk '/ext2/ { print $3 }' | \
51 mount -n -o ro,remount $line done); then