Commit | Line | Data |
---|---|---|
6dca1d21 JB |
1 | #!/bin/bash |
2 | # | |
3 | # /etc/rc.single: single-user startup script | |
4 | # | |
5 | ||
6 | # Load configuration | |
7 | . /etc/rc.conf | |
8 | ||
9 | if [ "$PREVLEVEL" = "2" ]; then | |
10 | # Shutdown services | |
11 | if [ "${SERVICES[*]}" ]; then | |
12 | for service in "${SERVICES[@]}"; do | |
13 | R_SERVICES=($service ${R_SERVICES[@]}) | |
14 | done | |
15 | for service in "${R_SERVICES[@]}"; do | |
16 | /etc/rc.d/$service stop &> /tmp/rc.$$ | |
17 | /usr/bin/logger -t $service -f /tmp/rc.$$ | |
18 | /bin/rm -f /tmp/rc.$$ | |
19 | done | |
20 | fi | |
21 | fi | |
22 | ||
23 | if [ "$PREVLEVEL" != "N" ]; then | |
24 | # Terminate all processes | |
25 | /sbin/killall5 -15 | |
26 | /bin/sleep 5 | |
27 | /sbin/killall5 -9 | |
28 | ||
29 | # Start udev | |
30 | /bin/mount -n -t proc none /proc | |
31 | /bin/mount -n -t sysfs none /sys | |
32 | /sbin/start_udev | |
33 | ||
34 | if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then | |
35 | /etc/rc.d/$SYSLOG start &> /dev/null | |
36 | fi | |
37 | fi | |
38 | ||
39 | if [ "$RUNLEVEL" = "1" ]; then | |
40 | # Enter single-user mode | |
41 | exec /sbin/init -t1 S | |
42 | fi | |
43 | ||
44 | # End of file |