3 # single Script for sedding up administrative/rescue shell.
6 # description: This file is executed by init when it goes into runlevel \
7 # 1, which is the administrative state. It kills all \
8 # deamons and then puts the system into single user mode. \
9 # Note that the file systems are kept mounted. \
11 # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
14 # Source function library.
15 . /etc/rc.d/init.d/functions
23 [ "${BASH+bash}" = bash ] && enable kill
25 run_cmd "Sending all processes the TERM signal" killall5 -15
27 run_cmd "Sending all processes the KILL signal" killall5 -9
29 rm -f /var/lock/subsys/* >/dev/null 2>&1
32 [ -x /usr/bin/clear ] && /usr/bin/clear
34 # make sure modprobe is working
35 if [ -f /proc/sys/kernel/modprobe ]; then
36 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
39 # If they want to run something in single user mode, might as well run it...
40 for i in /etc/rc.d/rc1.d/S[0-9][0-9]*; do
41 # Check if the script is there.
42 [ ! -f $i ] && continue
44 # Don't run [KS]??foo.{rpmsave,rpmorig} scripts
45 [ "${i%.rpmsave}" != "${i}" ] && continue
46 [ "${i%.rpmorig}" != "${i}" ] && continue
47 [ "${i%.rpmnew}" != "${i}" ] && continue
48 [ "$i" = "/etc/rc.d/rc1.d/S00single" ] && continue
52 # Now go to the single user level.
53 show "Telling INIT to go to single user mode"; ok