wok-6.x rev 2319

Samba: improve start script
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 27 11:47:51 2009 +0000 (2009-02-27)
parents fa8a5ded702a
children abd9e3167576
files samba/stuff/etc/init.d/samba
line diff
     1.1 --- a/samba/stuff/etc/init.d/samba	Thu Feb 26 12:32:55 2009 +0000
     1.2 +++ b/samba/stuff/etc/init.d/samba	Fri Feb 27 11:47:51 2009 +0000
     1.3 @@ -18,43 +18,39 @@
     1.4  case "$1" in
     1.5    start)
     1.6      if active_pidfile $SMBPIDFILE smbd ; then
     1.7 -      echo "$NAME already running."
     1.8 -      exit 1
     1.9 +      echo "$NAME: $SMBD already running."
    1.10 +    else
    1.11 +      echo -n "Starting $DESC: $SMBD... "
    1.12 +      $SMBD -D
    1.13 +      status
    1.14      fi
    1.15 -    echo -n "Starting $DESC: $SMBD... "
    1.16 -    $SMBD -D
    1.17 -    status
    1.18 -    echo -n "Starting $DESC: $NMBD... "
    1.19 -    $NMBD -D
    1.20 -    status
    1.21 +    if active_pidfile $NMBPIDFILE smbd ; then
    1.22 +      echo "$NAME: $NMBD already running."
    1.23 +    else
    1.24 +      echo -n "Starting $DESC: $NMBD... "
    1.25 +      $NMBD -D
    1.26 +      status
    1.27 +    fi
    1.28      ;;
    1.29    stop)
    1.30      if ! active_pidfile $SMBPIDFILE smbd ; then
    1.31 -      echo "$NAME is not running."
    1.32 -      exit 1
    1.33 +      echo "$NAME: $SMBD is not running."
    1.34 +    else
    1.35 +      echo -n "Stopping $DESC: $SMBD... "
    1.36 +      kill `cat $SMBPIDFILE`
    1.37 +      status
    1.38      fi
    1.39 -    echo -n "Stopping $DESC: $SMBD... "
    1.40 -    kill `cat $SMBPIDFILE`
    1.41 -    status
    1.42 -    echo -n "Stopping $DESC: $NMBD... "
    1.43 -    kill `cat $NMBPIDFILE`
    1.44 -    status
    1.45 +    if ! active_pidfile $NMBPIDFILE smbd ; then
    1.46 +      echo "$NAME: $NMBD is not running."
    1.47 +    else
    1.48 +      echo -n "Stopping $DESC: $NMBD... "
    1.49 +      kill `cat $NMBPIDFILE`
    1.50 +      status
    1.51 +    fi
    1.52      ;;
    1.53    restart)
    1.54 -    if ! active_pidfile $SMBPIDFILE smbd ; then
    1.55 -      echo "$NAME is not running."
    1.56 -      exit 1
    1.57 -    fi
    1.58 -    echo -n "Restarting $DESC: $SMBD... "
    1.59 -    kill `cat $SMBPIDFILE`
    1.60 -    sleep 2
    1.61 -    $SMBD -D
    1.62 -    status
    1.63 -    echo -n "Restarting $DESC: $NMBD... "
    1.64 -    kill `cat $NMBPIDFILE`
    1.65 -    sleep 2
    1.66 -    $NMBD -D
    1.67 -    status
    1.68 +    $0 stop
    1.69 +    $0 start
    1.70      ;;
    1.71    reload)
    1.72      if ! active_pidfile $SMBPIDFILE smbd ; then