aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions13
-rwxr-xr-xrc.multi5
-rwxr-xr-xrc.shutdown4
3 files changed, 17 insertions, 5 deletions
diff --git a/functions b/functions
index 63999a1..6be008f 100644
--- a/functions
+++ b/functions
@@ -151,6 +151,19 @@ ck_depends() {
done
}
+start_daemon() {
+ /etc/rc.d/$1 start
+}
+
+start_daemon_bkgd() {
+ stat_bkgd "Starting $1"
+ (/etc/rc.d/$1 start) &>/dev/null &
+}
+
+stop_daemon() {
+ /etc/rc.d/$1 stop
+}
+
#Source additional functions at the end to allow overrides
if [ -d /etc/rc.d/functions.d/ ]; then
for f in $(/bin/ls /etc/rc.d/functions.d/); do
diff --git a/rc.multi b/rc.multi
index 8050e98..731e48e 100755
--- a/rc.multi
+++ b/rc.multi
@@ -13,10 +13,9 @@
for daemon in "${DAEMONS[@]}"; do
if [ "$daemon" = "${daemon#!}" ]; then
if [ "$daemon" = "${daemon#@}" ]; then
- /etc/rc.d/$daemon start
+ start_daemon $daemon
else
- stat_bkgd "Starting ${daemon:1}"
- (/etc/rc.d/${daemon:1} start) &>/dev/null &
+ start_daemon_bkgd ${daemon:1}
fi
fi
done
diff --git a/rc.shutdown b/rc.shutdown
index 024a899..59f6e25 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -27,14 +27,14 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
let i=${#DAEMONS[@]}
while [ $i -ge 0 ]; do
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
- ck_daemon ${DAEMONS[$i]#@} || /etc/rc.d/${DAEMONS[$i]#@} stop
+ ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
fi
let i=i-1
done
# find any leftover daemons and shut them down in reverse order
if [ -d /var/run/daemons ]; then
for daemon in $(/bin/ls -1t /var/run/daemons); do
- /etc/rc.d/$daemon stop
+ stop_daemon $daemon
done
fi
fi