aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/functions
diff options
context:
space:
mode:
authorFlorian La Roche <laroche@redhat.com>2002-07-14 06:39:59 +0000
committerFlorian La Roche <laroche@redhat.com>2002-07-14 06:39:59 +0000
commit3a03bf05c5165fd7bfc787615f3e7d58059ece9c (patch)
treec827ac310e53ca0189fbf62b5e9c8fdf10be7bd1 /rc.d/init.d/functions
parentd3deec1b263cfe043c8034d76f8c0b85eaa40ad4 (diff)
downloadinitscripts-3a03bf05c5165fd7bfc787615f3e7d58059ece9c.tar
initscripts-3a03bf05c5165fd7bfc787615f3e7d58059ece9c.tar.gz
initscripts-3a03bf05c5165fd7bfc787615f3e7d58059ece9c.tar.bz2
initscripts-3a03bf05c5165fd7bfc787615f3e7d58059ece9c.tar.xz
initscripts-3a03bf05c5165fd7bfc787615f3e7d58059ece9c.zip
- only coding style changes
Diffstat (limited to 'rc.d/init.d/functions')
-rwxr-xr-xrc.d/init.d/functions30
1 files changed, 14 insertions, 16 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index d14807d1..15a7fad1 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -72,9 +72,10 @@ fi
# Check if $pid (could be plural) are running
checkpid() {
- while [ "$1" ]; do
- [ -d "/proc/$1" ] && return 0
- shift
+ local i
+
+ for i in $* ; do
+ [ -d "/proc/$i" ] && return 0
done
return 1
}
@@ -228,7 +229,6 @@ killproc() {
# A function to find the pid of a program. Looks *only* at the pidfile
pidfileofproc() {
local base=${1##*/}
- local pid
# Test syntax.
if [ "$#" = 0 ] ; then
@@ -237,13 +237,13 @@ pidfileofproc() {
fi
# First try "/var/run/*.pid" files
- if [ -f /var/run/${base}.pid ] ; then
+ if [ -f /var/run/$base.pid ] ; then
local line p pid=
- read line < /var/run/${base}.pid
+ read line < /var/run/$base.pid
for p in $line ; do
[ -z "${p//[0-9]/}" -a -d /proc/$p ] && pid="$pid $p"
done
- if [ -n "${pid:-}" ] ; then
+ if [ -n "$pid" ]; then
echo $pid
return 0
fi
@@ -255,27 +255,25 @@ pidofproc() {
base=${1##*/}
# Test syntax.
- if [ "$#" = 0 ] ; then
+ if [ "$#" = 0 ]; then
echo $"Usage: pidofproc {program}"
return 1
fi
# First try "/var/run/*.pid" files
- if [ -f /var/run/${base}.pid ] ; then
+ if [ -f /var/run/$base.pid ]; then
local line p pid=
- read line < /var/run/${base}.pid
+ read line < /var/run/$base.pid
for p in $line ; do
[ -z "${p//[0-9]/}" -a -d /proc/$p ] && pid="$pid $p"
done
- if [ -n "${pid:-}" ] ; then
+ if [ -n "$pid" ]; then
echo $pid
return 0
fi
fi
-
- # Next try "pidof"
pidof -o $$ -o $PPID -o %PPID -x $1 || \
- pidof -o $$ -o $PPID -o %PPID -x ${base}
+ pidof -o $$ -o $PPID -o %PPID -x $base
}
status() {
@@ -291,7 +289,7 @@ status() {
# First try "pidof"
pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
pidof -o $$ -o $PPID -o %PPID -x ${base}`
- if [ "$pid" != "" ] ; then
+ if [ -n "$pid" ]; then
echo $"${base} (pid $pid) is running..."
return 0
fi
@@ -299,7 +297,7 @@ status() {
# Next try "/var/run/*.pid" files
if [ -f /var/run/${base}.pid ] ; then
read pid < /var/run/${base}.pid
- if [ "$pid" != "" ] ; then
+ if [ -n "$pid" ]; then
echo $"${base} dead but pid file exists"
return 1
fi