summaryrefslogtreecommitdiff
path: root/rc/rc.single
blob: 6940bd3308a5a115c84fc85cea4a9f83c7accd55 (plain)
    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 	/usr/bin/sleep 5
   27 	/sbin/killall5 -9
   28 
   29 	# Start device management daemon
   30 	/sbin/devfsd /dev
   31 
   32 	# Start log daemons
   33 	/usr/sbin/syslogd
   34 	/usr/sbin/klogd -c 4
   35 fi
   36 
   37 if [ "$RUNLEVEL" = "1" ]; then
   38 	# Enter single-user mode
   39 	exec /sbin/init -t1 S
   40 fi
   41 
   42 # End of file

Generated by cgit