]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # rc.halt for ipfire 2006 | |
4 | # | |
5 | ||
6 | progressbar() | |
7 | { | |
8 | if [ $# != 1 ] | |
9 | then | |
10 | echo "Usage: progressbar {progress}" | |
11 | exit 1 | |
12 | fi | |
13 | if [ -e /proc/splash ]; then | |
14 | echo "show $(( 65534 * $1 / 9 ))" > /proc/splash | |
15 | fi | |
16 | } | |
17 | # Set bootsplash | |
18 | progressbar 9 | |
19 | if [ -e /proc/splash ]; then | |
20 | echo "silent" > /proc/splash | |
21 | fi | |
22 | ||
23 | echo "Stopping the RED interface..." | |
24 | progressbar 8 | |
25 | /etc/rc.d/rc.red stop 2>/dev/null | |
26 | /etc/rc.d/rc.red clear 2>/dev/null | |
27 | ||
28 | echo "Shutting down..." | |
29 | progressbar 7 | |
30 | sleep 3 | |
31 | ||
32 | echo "Saving the clock" | |
33 | progressbar 6 | |
34 | /sbin/hwclock --systohc | |
35 | ||
36 | echo "Sending all processes the TERM signal..." | |
37 | progressbar 5 | |
38 | /sbin/killall5 -15 | |
39 | sleep 3 | |
40 | ||
41 | echo "Sending all processes the KILL signal..." | |
42 | progressbar 4 | |
43 | /sbin/killall5 -9 | |
44 | sleep 3 | |
45 | ||
46 | echo "Turning off swap" | |
47 | progressbar 3 | |
48 | swapoff -a | |
49 | ||
50 | echo "Unmounting others" | |
51 | progressbar 2 | |
52 | umount -n -a | |
53 | ||
54 | echo "Unmounting root" | |
55 | progressbar 1 | |
56 | mount -n -o remount,ro / | |
57 | ||
58 | # Send nice shutdown beep now | |
59 | progressbar 0 | |
60 | /usr/bin/beep -l 75 -f 3000 | |
61 | /usr/bin/beep -l 75 -f 2000 | |
62 | /usr/bin/beep -l 75 -f 1000 | |
63 | /usr/bin/beep -l 75 -f 500 | |
64 | ||
65 | if [ "$1" = "halt" ]; then | |
66 | halt -i -d -p | |
67 | else | |
68 | reboot -i -d | |
69 | fi |