]> git.pld-linux.org Git - projects/rc-scripts.git/blame - rc.d/init.d/single
Umount remaining filesystems one by one (using -R) option which helps in cases when...
[projects/rc-scripts.git] / rc.d / init.d / single
CommitLineData
12de71be 1#!/bin/sh
7742e157 2#
de1fc6ce 3# single Script for sedding up administrative/rescue shell.
7742e157 4#
8d86e6df 5# chkconfig: 1 00 00
12de71be 6# description: This file is executed by init when it goes into runlevel \
8d86e6df 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. \
7742e157 10#
8d86e6df 11# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
5e6dfc29 12#
7742e157 13
df513ab1 14# Source function library.
7e04fe0e 15. /etc/rc.d/init.d/functions
16
12de71be 17case "$1" in
5e6dfc29 18 stop*)
12de71be 19 exit 0
20 ;;
5e6dfc29 21 start*)
df513ab1 22 # Kill all processes.
12de71be 23 [ "${BASH+bash}" = bash ] && enable kill
7742e157 24
52f756ea 25 run_cmd "Sending all processes the TERM signal" killall5 -15
12de71be 26 sleep 5
52f756ea 27 run_cmd "Sending all processes the KILL signal" killall5 -9
7742e157 28
354b37ce 29 rm -f /var/lock/subsys/* >/dev/null 2>&1
7742e157 30
df513ab1 31 # this looks nicer
12de71be 32 [ -x /usr/bin/clear ] && /usr/bin/clear
7742e157 33
5b947b6f
ER
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
37 fi
38
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
43
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
49 $i start
50 done
12de71be 51
52 # Now go to the single user level.
cee18a41 53 show "Telling INIT to go to single user mode"; ok
12de71be 54 exec init -t1 S
55 ;;
56esac
This page took 0.113207 seconds and 5 git commands to generate.