core/rc/rc.single
2006-02-23 15:26:10 +00:00

43 lines
772 B
Bash
Executable File

#!/bin/bash
#
# /etc/rc.single: single-user startup script
#
# Load configuration
. /etc/rc.conf
if [ "$PREVLEVEL" = "2" ]; then
# Shutdown services
if [ "${SERVICES[*]}" ]; then
for service in "${SERVICES[@]}"; do
R_SERVICES=($service ${R_SERVICES[@]})
done
for service in "${R_SERVICES[@]}"; do
/etc/rc.d/$service stop &> /tmp/rc.$$
/usr/bin/logger -t $service -f /tmp/rc.$$
/bin/rm -f /tmp/rc.$$
done
fi
fi
if [ "$PREVLEVEL" != "N" ]; then
# Terminate all processes
/sbin/killall5 -15
/usr/bin/sleep 5
/sbin/killall5 -9
# Start device management daemon
/sbin/devfsd /dev
# Start log daemons
/usr/sbin/syslogd
/usr/sbin/klogd -c 4
fi
if [ "$RUNLEVEL" = "1" ]; then
# Enter single-user mode
exec /sbin/init -t1 S
fi
# End of file