aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/functions
diff options
context:
space:
mode:
authorFlorian La Roche <laroche@redhat.com>2002-07-11 07:41:06 +0000
committerFlorian La Roche <laroche@redhat.com>2002-07-11 07:41:06 +0000
commitde33ef43313eb1075030b8615de15c56192dadc4 (patch)
treeca04a0194f1ed11741ed673a8c326a717a43adab /rc.d/init.d/functions
parentd9d075c580f39e3b6597ff65723845939e9880dc (diff)
downloadinitscripts-de33ef43313eb1075030b8615de15c56192dadc4.tar
initscripts-de33ef43313eb1075030b8615de15c56192dadc4.tar.gz
initscripts-de33ef43313eb1075030b8615de15c56192dadc4.tar.bz2
initscripts-de33ef43313eb1075030b8615de15c56192dadc4.tar.xz
initscripts-de33ef43313eb1075030b8615de15c56192dadc4.zip
- /etc/init.d/functions:
daemon(): avoid starting another bash killproc(): avoid starting another bash for the default case - do not call "insmod -p" before loading the "st" module
Diffstat (limited to 'rc.d/init.d/functions')
-rwxr-xr-xrc.d/init.d/functions34
1 files changed, 26 insertions, 8 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 996203a2..99be58c4 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -73,7 +73,7 @@ fi
# Check if $pid (could be plural) are running
checkpid() {
while [ "$1" ]; do
- [ -d /proc/$1 ] && return 0
+ [ -d "/proc/$1" ] && return 0
shift
done
return 1
@@ -84,7 +84,7 @@ checkpid() {
daemon() {
# Test syntax.
local gotbase= force=
- local base= user= nice= bg= pid
+ local base= user= nice= bg= pid=
nicelevel=0
while [ "$1" != "${1##[-+]}" ]; do
case $1 in
@@ -125,7 +125,13 @@ daemon() {
[ -z "$gotbase" ] && base=${1##*/}
# See if it's already running. Look *only* at the pid file.
- pid=`pidfileofproc $base`
+ if [ -f /var/run/${base}.pid ]; then
+ local line p
+ read line < /var/run/${base}.pid
+ for p in $line ; do
+ [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
+ done
+ fi
[ -n "${pid:-}" -a -z "${force:-}" ] && return
@@ -156,7 +162,7 @@ killproc() {
notset=0
# check for second arg to be kill level
- if [ "$2" != "" ] ; then
+ if [ -n "$2" ]; then
killlevel=$2
else
notset=1
@@ -167,9 +173,17 @@ killproc() {
base=${1##*/}
# Find pid.
- pid=`pidofproc $1`
- if [ -z "${pid:-}" ] ; then
- pid=`pidofproc $base`
+ pid=
+ if [ -f /var/run/${base}.pid ]; then
+ local line p
+ read line < /var/run/${base}.pid
+ for p in $line ; do
+ [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
+ done
+ fi
+ if [ -z "$pid" ]; then
+ pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
+ pidof -o $$ -o $PPID -o %PPID -x $base`
fi
# Kill it.
@@ -193,7 +207,7 @@ killproc() {
RC=$((! $RC))
# use specified level only
else
- if checkpid $pid >/dev/null 2>&1; then
+ if checkpid $pid; then
kill $killlevel $pid
RC=$?
[ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel"
@@ -412,6 +426,10 @@ action() {
# returns OK if $1 contains $2
strstr() {
+ #case "$1" in
+ # *${2}*) return 0 ;;
+ #esac
+ #return 1
[ "$1" = "$2" ] && return 0
slice=${1#*$2*}
[ "$slice" = "$1" ] && return 1