--- samba.orig 2008-07-02 15:50:46.000000000 +0200 +++ samba 2008-07-02 16:14:00.000000000 +0200 @@ -19,6 +19,7 @@ PIDDIR=/var/run/samba NMBDPID=$PIDDIR/nmbd.pid SMBDPID=$PIDDIR/smbd.pid +NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null` # clear conflicting settings from the environment unset TMPDIR @@ -34,7 +35,6 @@ # Make sure we have our PIDDIR, even if it's on a tmpfs install -o root -g root -m 755 -d $PIDDIR - NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null` if [ "$NMBD_DISABLED" != 'Yes' ]; then log_progress_msg "nmbd" if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D @@ -84,6 +84,47 @@ log_end_msg 0 ;; + status) + SMBRETURN=3 + NMBRETURN=3 + if [ ! -f $SMBDPID ]; then + echo "smbd not running." + else + PIDS_SMBD=`cat $SMBDPID` + if ps $PIDS_SMBD | grep -q smbd; then + echo "smbd running." + SMBRETURN=0 + else + echo "smbd not running, but pidfile exists." + SMBRETURN=1 + fi + fi + if [ "$NMBD_DISABLED" != 'Yes' ] && [ "$RUN_MODE" != "inetd" ]; then + if [ ! -f $NMBDPID ]; then + echo "nmbd not running." + else + PIDS_NMBD=`cat $NMBDPID` + if ps $PIDS_NMBD | grep -q nmbd; then + echo "nmbd running." + NMBRETURN=0 + else + echo "nmbd not running, but pidfile exists." + NMBRETURN=1 + fi + fi + if [ $SMBRETURN -eq 1 ] || [ $NMBRETURN -eq 1 ]; then + exit 1 + elif [ $SMBRETURN -eq $NMBRETURN ]; then + exit $SMBRETURN + else + # Apparantly, we have an unknown state, or at least something + # that we can't fix easily + return 4 + fi + else + return $SMBRETURN + fi + ;; reload) log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only"