slitaz-boot-scripts rev 127 2.6.1

active_pidfile: avoid error msg
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 01 23:27:32 2008 +0000 (2008-12-01)
parents ea125bdc0888
children fe56eb67ba59
files etc/init.d/rc.functions
line diff
     1.1 --- a/etc/init.d/rc.functions	Mon Dec 01 22:03:15 2008 +0100
     1.2 +++ b/etc/init.d/rc.functions	Mon Dec 01 23:27:32 2008 +0000
     1.3 @@ -29,10 +29,12 @@
     1.4  # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
     1.5  active_pidfile()
     1.6  {
     1.7 -	if grep -qs "Name:.$(basename $2)$" /proc/$(cat $1)/status ; then
     1.8 +	if [ ! -e $1 ]; then
     1.9 +		return 1
    1.10 +	elif grep -qs "Name:.$(basename $2)$" /proc/$(cat $1)/status ; then
    1.11  		return 0
    1.12  	else
    1.13  		rm -f $1
    1.14 -		return 1
    1.15 +		return 2
    1.16  	fi
    1.17  }