aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-02-04 19:11:11 +0000
committerBill Nottingham <notting@redhat.com>1999-02-04 19:11:11 +0000
commitae6c4e57c4eda13956a9e5efe0956fd5c90e3a7c (patch)
tree3c12193fed2a085b512af8cc30d7865adfb10186 /rc.d/init.d
parente8d2f95c03d1df94ca6ab9bab11f0f1d8e8c5893 (diff)
downloadinitscripts-ae6c4e57c4eda13956a9e5efe0956fd5c90e3a7c.tar
initscripts-ae6c4e57c4eda13956a9e5efe0956fd5c90e3a7c.tar.gz
initscripts-ae6c4e57c4eda13956a9e5efe0956fd5c90e3a7c.tar.bz2
initscripts-ae6c4e57c4eda13956a9e5efe0956fd5c90e3a7c.tar.xz
initscripts-ae6c4e57c4eda13956a9e5efe0956fd5c90e3a7c.zip
fixes
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-xrc.d/init.d/functions64
-rwxr-xr-xrc.d/init.d/halt7
-rwxr-xr-xrc.d/init.d/network4
-rwxr-xr-xrc.d/init.d/nfsfs4
-rwxr-xr-xrc.d/init.d/random4
5 files changed, 41 insertions, 42 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index c3b42a65..882748f7 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -18,9 +18,14 @@ if [ -f /etc/sysconfig/init ]; then
. /etc/sysconfig/init
else
BOOTUP=color
+ LOGLEVEL=1
fi
-
+if [ "$BOOTUP" = "color" ]; then
+ INITLOG_ARGS="-q"
+else
+ INITLOG_ARGS=
+fi
# A function to start a program.
daemon() {
@@ -45,10 +50,10 @@ daemon() {
ulimit -c 0
# Echo daemon
- [ $BOOTUP != "color" ] && echo -n $base
+ [ $BOOTUP != "color" ] && echo -n " $base"
# And start it up.
- nice -n $nicelevel initlog -q -c "$*" && success -n "$base startup" || failure -n "$base startup"
+ nice -n $nicelevel initlog $INITLOG_ARGS -c "$*" && success "$base startup" || failure "$base startup"
}
# A function to stop a program.
@@ -76,24 +81,24 @@ killproc() {
# Kill it.
if [ "$pid" != "" ] ; then
- [ $BOOTUP != "color" ] && echo -n $base
+ [ $BOOTUP != "color" ] && echo -n "$base "
if [ "$notset" = 1 ] ; then
# TERM first, then KILL if not dead
- kill -TERM $pid && success -n "$base shutdown" || failure -n "$base shutdown"
+ kill -TERM $pid && success "$base shutdown" || failure "$base shutdown"
usleep 100000
if ps h $pid >/dev/null 2>&1 ; then
sleep 1
if ps h $pid >/dev/null 2>&1 ; then
sleep 3
- kill -KILL $pid && success -n "$base shutdown" || failure -n "$base shutdown"
+ kill -KILL $pid && success "$base shutdown" || failure "$base shutdown"
fi
fi
# use specified level only
else
- kill $killlevel $pid && success -n "$base shutdown" || failure -n "$base shutdown"
+ kill $killlevel $pid && success "$base shutdown" || failure "$base shutdown"
fi
else
- failure -n "$base shutdown"
+ failure "$base shutdown"
fi
# Remove pid file if any.
@@ -167,62 +172,48 @@ status() {
}
echo_success() {
- echo $* "[ OK ]"
+ echo -n "[ OK ]"
return 0
}
echo_failure() {
- echo $* "[FAILED]"
- return 0
+ echo -n "[FAILED]"
+ return 1
}
# Log that something succeeded
success() {
- if [ "$1" = "-n" ]; then
- ECHOARGS="-n"
- shift
- else
- ECHOARGS=""
- fi
if [ -z "$IN_INITLOG" ]; then
initlog -n $0 -s "$1" -e 1
else
echo "-n $0 -s \"$1\" -e 1" >&21
fi
- [ "$BOOTUP" = "color" ] && echo_success $ECHOARGS
+ [ "$BOOTUP" = "color" ] && echo_success
return 0
}
# Log that something failed
failure() {
- if [ "$1" = "-n" ]; then
- ECHOARGS="-n"
- shift
- else
- ECHOARGS=""
- fi
+ rc=$?
if [ -z "$IN_INITLOG" ]; then
initlog -n $0 -s "$1" -e 2
else
echo "-n $0 -s \"$1\" -e 2" >&21
fi
- [ "$BOOTUP" = "color" ] && echo_failure $ECHOARGS
- return 0
+ [ "$BOOTUP" = "color" ] && echo_failure
+ return $rc
}
# Run some action. Log its output.
action() {
- if [ "$1" = "-n" ]; then
- ECHOARGS="-n"
- shift
- else
- ECHOARGS=""
- fi
STRING=$1
- echo $ECHOARGS "$STRING "
+ echo -n "$STRING "
shift
if [ -z "$IN_INITLOG" ]; then
- initlog -q -c "$*" && success "$STRING" || failure "$STRING"
+ initlog $INITLOG_ARGS -c "$*" && success "$STRING" || failure "$STRING"
+ rc=$?
+ [ "$BOOTUP" = "color" ] && echo
+ return $rc
else
# This sucks.
output=`$*`
@@ -234,13 +225,16 @@ action() {
fi
if [ $rc ]; then
+ [ "$BOOTUP" = "color" ] || { echo ; echo $output ; }
success "$STRING"
else
+ echo
echo $output
failure "$STRING"
fi
+ [ "$BOOTUP" = "color" ] && echo
+ return $rc
fi
- return 0
}
# Confirm whether we really want to run this service
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 61eab7b3..08cf9b67 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -16,7 +16,12 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
runcmd() {
echo -n $1
shift
- $* && echo_success -n || echo_failure -n
+ if [ "$BOOTUP" = "color" ]; then
+ $* && echo_success || echo_failure
+ else
+ $*
+ fi
+ echo
}
# See how we were called.
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 93f86480..fa67df29 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -57,7 +57,7 @@ ipv4_forward_set ()
fi
if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then
- action -n "$message" /bin/true
+ action "$message" /bin/true
echo "$value" > /proc/sys/net/ipv4/ip_forward
fi
fi
@@ -96,7 +96,7 @@ case "$1" in
;;
esac
./ifdown ifcfg-lo
- action -n "Disabling IPv4 packet forwarding" /bin/true
+ action "Disabling IPv4 packet forwarding" /bin/true
echo 0 > /proc/sys/net/ipv4/ip_forward
rm -f /var/lock/subsys/network
;;
diff --git a/rc.d/init.d/nfsfs b/rc.d/init.d/nfsfs
index 9b828248..89cd4a53 100755
--- a/rc.d/init.d/nfsfs
+++ b/rc.d/init.d/nfsfs
@@ -26,11 +26,11 @@ fi
# See how we were called.
case "$1" in
start)
- action -n "Mounting remote filesystems" mount -a -t nfs
+ action "Mounting remote filesystems" mount -a -t nfs
touch /var/lock/subsys/nfsfs
;;
stop)
- action -n "Unmounting remote filesystems" umount -a -t nfs
+ action "Unmounting remote filesystems" umount -a -t nfs
rm -f /var/lock/subsys/nfsfs
;;
status)
diff --git a/rc.d/init.d/random b/rc.d/init.d/random
index 27f2abd4..57b971f9 100755
--- a/rc.d/init.d/random
+++ b/rc.d/init.d/random
@@ -22,7 +22,7 @@ case "$1" in
else
touch $random_seed
fi
- action -n "Initializing random number generator" /bin/true
+ action "Initializing random number generator" /bin/true
chmod 600 $random_seed
dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
touch /var/lock/subsys/random
@@ -33,7 +33,7 @@ case "$1" in
# Save 512 bytes, which is the size of the entropy pool
touch $random_seed
chmod 600 $random_seed
- action -n "Saving random seed" dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
+ action "Saving random seed" dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
rm -f /var/lock/subsys/random
;;