aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/rc
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1997-09-16 14:12:05 +0000
committerErik Troan <ewt@redhat.com>1997-09-16 14:12:05 +0000
commitced9dffda28f1ec2b060f3e419cf3c6b964b03a1 (patch)
treeda3f56c24861ddc77e2910291c71adc12dca136b /rc.d/rc
downloadinitscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar
initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar.gz
initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar.bz2
initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar.xz
initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.zip
Initial revision
Diffstat (limited to 'rc.d/rc')
-rwxr-xr-xrc.d/rc54
1 files changed, 54 insertions, 0 deletions
diff --git a/rc.d/rc b/rc.d/rc
new file mode 100755
index 00000000..a2b94559
--- /dev/null
+++ b/rc.d/rc
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# rc This file is responsible for starting/stopping
+# services when the runlevel changes. It is also
+# responsible for the very first setup of basic
+# things, such as setting the hostname.
+#
+# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
+# Modified for RHS Linux by Damien Neil
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Now find out what the current and what the previous runlevel are.
+argv1="$1"
+set `/sbin/runlevel`
+runlevel=$2
+previous=$1
+export runlevel previous
+
+# Get first argument. Set new runlevel to this argument.
+[ "$1" != "" ] && runlevel="$argv1"
+
+# Is there an rc directory for this new runlevel?
+if [ -d /etc/rc.d/rc$runlevel.d ]; then
+ # First, run the KILL scripts.
+ for i in /etc/rc.d/rc$runlevel.d/K*; do
+ # Check if the script is there.
+ [ ! -f $i ] && continue
+
+ # Check if the subsystem is already up.
+ subsys=${i#/etc/rc.d/rc$runlevel.d/K??}
+ [ ! -f /var/lock/subsys/$subsys ] && \
+ [ ! -f /var/lock/subsys/${subsys}.init ] && continue
+
+ # Bring the subsystem down.
+ $i stop
+ done
+
+ # Now run the START scripts.
+ for i in /etc/rc.d/rc$runlevel.d/S*; do
+ # Check if the script is there.
+ [ ! -f $i ] && continue
+
+ # Check if the subsystem is already up.
+ subsys=${i#/etc/rc.d/rc$runlevel.d/S??}
+ [ -f /var/lock/subsys/$subsys ] && \
+ [ -f /var/lock/subsys/${subsys}.init ] && continue
+
+ # Bring the subsystem up.
+ $i start
+ done
+fi