]> git.pld-linux.org Git - projects/rc-scripts.git/blob - rc.d/init.d/shutdwn
- removed inputrc (it must be in readline),
[projects/rc-scripts.git] / rc.d / init.d / shutdwn
1 #!/bin/sh
2 #
3 # shutdwn       Common script for system halt/reboot.
4 #
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>
8 #
9
10 # Set the path.
11 PATH=/sbin:/bin:/usr/bin:/usr/sbin
12
13 . /etc/rc.d/init.d/functions
14
15 # Kill all processes.
16 [ "${BASH+bash}" = bash ] && enable kill
17
18 show "Sending all processes the TERM signal "
19 daemon killall5 -15
20 sleep 5
21 show "Sending all processes the KILL signal "
22 daemon killall5 -9
23
24 # Write to wtmp file before unmounting /var
25 halt -w
26
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 /
32
33 # turn off raid
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
42                 done
43                 unset mddev mddevs
44         fi
45         #runcmd "Turning off RAID" /sbin/raidstop -a
46 fi
47
48 show "Remounting remaining filesystems ro mode"; busy
49 if (mount | awk '/ext2/ { print $3 }' | \
50         while read line; do 
51                 mount -n -o ro,remount $line done); then
52         deltext; ok
53 else
54         deltext; fail
55 fi
This page took 0.02853 seconds and 3 git commands to generate.