aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2002-01-25 04:46:09 +0000
committerBill Nottingham <notting@redhat.com>2002-01-25 04:46:09 +0000
commitce9b1cc2142093ad5342bebefadee1b72164670a (patch)
tree5fcd83cd769071be7e39b5b509c5b6c8f4978e7c
parent44c9c3fff80a1d51d0317675129aee9aae4a008e (diff)
downloadinitscripts-ce9b1cc2142093ad5342bebefadee1b72164670a.tar
initscripts-ce9b1cc2142093ad5342bebefadee1b72164670a.tar.gz
initscripts-ce9b1cc2142093ad5342bebefadee1b72164670a.tar.bz2
initscripts-ce9b1cc2142093ad5342bebefadee1b72164670a.tar.xz
initscripts-ce9b1cc2142093ad5342bebefadee1b72164670a.zip
random syntax cleanups (#54494)
-rwxr-xr-xrc.d/init.d/functions23
1 files changed, 12 insertions, 11 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 8ec31e30..783bb815 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -120,7 +120,7 @@ daemon() {
done
# Save basename.
- [ -z $gotbase ] && base=${1##*/}
+ [ -z "$gotbase" ] && base=${1##*/}
# See if it's already running. Look *only* at the pid file.
pid=`pidfileofproc $base`
@@ -140,14 +140,14 @@ daemon() {
else
$nice initlog $INITLOG_ARGS -c "su - $user -c \"$*\"" && success $"$base startup" || failure $"$base startup"
fi
- [ $? = 0 ] && success $"$base startup" || failure $"$base startup"
+ [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
}
# A function to stop a program.
killproc() {
RC=0
# Test syntax.
- if [ $# = 0 ]; then
+ if [ "$#" -eq 0 ]; then
echo $"Usage: killproc {program} [signal]"
return 1
fi
@@ -172,8 +172,8 @@ killproc() {
# Kill it.
if [ -n "${pid:-}" ] ; then
- [ $BOOTUP = "verbose" ] && echo -n "$base "
- if [ "$notset" = "1" ] ; then
+ [ "$BOOTUP" = "verbose" ] && echo -n "$base "
+ if [ "$notset" -eq "1" ] ; then
if checkpid $pid 2>&1; then
# TERM first, then KILL if not dead
kill -TERM $pid
@@ -187,14 +187,14 @@ killproc() {
fi
checkpid $pid
RC=$?
- [ $RC -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown"
+ [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown"
RC=$((! $RC))
# use specified level only
else
if checkpid $pid >/dev/null 2>&1; then
kill $killlevel $pid
RC=$?
- [ $RC -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel"
+ [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel"
fi
fi
else
@@ -215,14 +215,15 @@ pidfileofproc() {
local pid
# Test syntax.
- if [ $# = 0 ] ; then
+ if [ "$#" = 0 ] ; then
echo $"Usage: pidfileofproc {program}"
return 1
fi
# First try "/var/run/*.pid" files
if [ -f /var/run/${base}.pid ] ; then
- read pid < /var/run/${base}.pid
+ local line p pid=
+ read line < /var/run/${base}.pid
for p in $line ; do
[ -z "${p//[0-9]/}" -a -d /proc/$p ] && pid="$pid $p"
done
@@ -238,7 +239,7 @@ pidofproc() {
base=${1##*/}
# Test syntax.
- if [ $# = 0 ] ; then
+ if [ "$#" = 0 ] ; then
echo $"Usage: pidofproc {program}"
return 1
fi
@@ -266,7 +267,7 @@ status() {
local pid
# Test syntax.
- if [ $# = 0 ] ; then
+ if [ "$#" = 0 ] ; then
echo $"Usage: status {program}"
return 1
fi