wok-next rev 3875
Busybox: ensure pidfile are valid
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Aug 10 13:56:55 2009 +0200 (2009-08-10) |
parents | cb5d40864a83 |
children | ce2d65bd0418 |
files | busybox/stuff/dnsd busybox/stuff/udhcpd busybox/stuff/zcip |
line diff
1.1 --- a/busybox/stuff/dnsd Mon Aug 10 13:16:15 2009 +0200 1.2 +++ b/busybox/stuff/dnsd Mon Aug 10 13:56:55 2009 +0200 1.3 @@ -16,16 +16,16 @@ 1.4 1.5 case "$1" in 1.6 start) 1.7 - if [ -f $PIDFILE ] ; then 1.8 + if active_pidfile $PIDFILE dnsd ; then 1.9 echo "$NAME already running." 1.10 exit 1 1.11 fi 1.12 echo -n "Starting $DESC: $NAME... " 1.13 - $DAEMON $OPTIONS 1.14 + $DAEMON $OPTIONS && echo `pidof $DAEMON` > $PIDFILE 1.15 status 1.16 ;; 1.17 stop) 1.18 - if [ ! -f $PIDFILE ] ; then 1.19 + if ! active_pidfile $PIDFILE dnsd ; then 1.20 echo "$NAME is not running." 1.21 exit 1 1.22 fi 1.23 @@ -35,7 +35,7 @@ 1.24 status 1.25 ;; 1.26 restart) 1.27 - if [ ! -f $PIDFILE ] ; then 1.28 + if ! active_pidfile $PIDFILE dnsd ; then 1.29 echo "$NAME is not running." 1.30 exit 1 1.31 fi
2.1 --- a/busybox/stuff/udhcpd Mon Aug 10 13:16:15 2009 +0200 2.2 +++ b/busybox/stuff/udhcpd Mon Aug 10 13:56:55 2009 +0200 2.3 @@ -16,7 +16,7 @@ 2.4 2.5 case "$1" in 2.6 start) 2.7 - if [ -f $PIDFILE ] ; then 2.8 + if active_pidfile $PIDFILE udhcpc ; then 2.9 echo "$NAME already running." 2.10 exit 1 2.11 fi 2.12 @@ -25,7 +25,7 @@ 2.13 status 2.14 ;; 2.15 stop) 2.16 - if [ ! -f $PIDFILE ] ; then 2.17 + if ! active_pidfile $PIDFILE udhcpc ; then 2.18 echo "$NAME is not running." 2.19 exit 1 2.20 fi 2.21 @@ -34,7 +34,7 @@ 2.22 status 2.23 ;; 2.24 restart) 2.25 - if [ ! -f $PIDFILE ] ; then 2.26 + if ! active_pidfile $PIDFILE udhcpc ; then 2.27 echo "$NAME is not running." 2.28 exit 1 2.29 fi
3.1 --- a/busybox/stuff/zcip Mon Aug 10 13:16:15 2009 +0200 3.2 +++ b/busybox/stuff/zcip Mon Aug 10 13:56:55 2009 +0200 3.3 @@ -7,16 +7,18 @@ 3.4 # 3.5 . /etc/init.d/rc.functions 3.6 . /etc/daemons.conf 3.7 +. /etc/network.conf 3.8 3.9 NAME=Zcip 3.10 DESC="ZeroConf deamon" 3.11 DAEMON=/sbin/zcip 3.12 OPTIONS=$ZCIP_OPTIONS 3.13 PIDFILE=/var/run/zcip.pid 3.14 +[ -n "$OPTIONS" ] || OPTIONS="$INTERFACE /etc/zcip.script" 3.15 3.16 case "$1" in 3.17 start) 3.18 - if [ -f $PIDFILE ] ; then 3.19 + if active_pidfile $PIDFILE zcip ; then 3.20 echo "$NAME already running." 3.21 exit 1 3.22 fi 3.23 @@ -25,7 +27,7 @@ 3.24 status 3.25 ;; 3.26 stop) 3.27 - if [ ! -f $PIDFILE ] ; then 3.28 + if ! active_pidfile $PIDFILE zcip ; then 3.29 echo "$NAME is not running." 3.30 exit 1 3.31 fi 3.32 @@ -35,7 +37,7 @@ 3.33 status 3.34 ;; 3.35 restart) 3.36 - if [ ! -f $PIDFILE ] ; then 3.37 + if ! active_pidfile $PIDFILE zcip ; then 3.38 echo "$NAME is not running." 3.39 exit 1 3.40 fi