]> git.pld-linux.org Git - projects/rc-scripts.git/blob - rc.d/init.d/single
usbfs is deprecated for some time.
[projects/rc-scripts.git] / rc.d / init.d / single
1 #!/bin/sh
2 #
3 # single        Script for sedding up administrative/rescue shell.
4 #
5 # chkconfig:    1 00 00
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. \
10 #
11 # Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
12 #
13 # $Id$
14
15 # Source function library.
16 . /etc/rc.d/init.d/functions
17
18 case "$1" in
19   stop*)
20         exit 0
21         ;;
22   start*)
23         # Kill all processes.
24         [ "${BASH+bash}" = bash ] && enable kill
25
26         run_cmd "Sending all processes the TERM signal" killall5 -15
27         sleep 5
28         run_cmd "Sending all processes the KILL signal" killall5 -9
29
30         rm -f /var/lock/subsys/* >/dev/null 2>&1
31
32         # this looks nicer
33         [ -x /usr/bin/clear ] && /usr/bin/clear
34
35         # make sure modprobe is working
36         if [ -f /proc/sys/kernel/modprobe ]; then
37                 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
38         fi
39
40         # If they want to run something in single user mode, might as well run it...
41         for i in /etc/rc.d/rc1.d/S[0-9][0-9]*; do
42                 # Check if the script is there.
43                 [ ! -f $i ] && continue
44
45                 # Don't run [KS]??foo.{rpmsave,rpmorig} scripts
46                 [ "${i%.rpmsave}" != "${i}" ] && continue
47                 [ "${i%.rpmorig}" != "${i}" ] && continue
48                 [ "${i%.rpmnew}" != "${i}" ] && continue
49                 [ "$i" = "/etc/rc.d/rc1.d/S00single" ] && continue
50                 $i start
51         done
52
53         # Now go to the single user level.
54         show "Telling INIT to go to single user mode"; ok
55         exec init -t1 S
56         ;;
57 esac
This page took 0.028484 seconds and 3 git commands to generate.