diff options
-rw-r--r-- | initscripts.spec | 6 | ||||
-rwxr-xr-x | rc.d/init.d/functions | 34 | ||||
-rwxr-xr-x | rc.d/rc.sysinit | 11 |
3 files changed, 36 insertions, 15 deletions
diff --git a/initscripts.spec b/initscripts.spec index f844166c..648226c2 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -244,6 +244,12 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/locale/*/LC_MESSAGES %changelog +* Thu Jul 11 2002 Florian La Roche <Florian.LaRoche@redhat.de> +- /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 + * Tue Jul 09 2002 Florian La Roche <Florian.LaRoche@redhat.de> - allow an option for ups poweroff #68123 - change grep for ONBOOT= #63903 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]= |