aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
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
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')
-rwxr-xr-xrc.d/init.d/functions34
-rwxr-xr-xrc.d/rc.sysinit11
2 files changed, 30 insertions, 15 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
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index f1a09764..0c866bce 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -331,7 +331,7 @@ if [ -n "$IN_INITLOG" ]; then
IN_INITLOG=
fi
-if ! grep -iq nomodules /proc/cmdline >/dev/null 2>&1 && [ -f /proc/ksyms ]; then
+if ! grep -iq nomodules /proc/cmdline 2>/dev/null && [ -f /proc/ksyms ]; then
USEMODULES=y
fi
@@ -619,11 +619,8 @@ fi
# If a SCSI tape has been detected, load the st module unconditionally
# since many SCSI tapes don't deal well with st being loaded and unloaded
if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
- if grep -qv ' 9 st' /proc/devices ; then
- if [ -n "$USEMODULES" ]; then
- # Try to load the module. If it fails, ignore it...
- insmod -p st >/dev/null 2>&1 && modprobe st >/dev/null 2>&1
- fi
+ if grep -qv ' 9 st' /proc/devices && [ -n "$USEMODULES" ]; then
+ modprobe st >/dev/null 2>&1
fi
fi
@@ -664,7 +661,7 @@ disk[17]=hdq; disk[18]=hdr; disk[19]=hds; disk[20]=hdt;
if [ -x /sbin/hdparm ]; then
for device in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
+ unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then
. /etc/sysconfig/harddisk${disk[$device]}
HDFLAGS[$device]=