Samba TNG start and stop script

Clair Roberts clairroberts at home.com
Mon Mar 6 22:55:14 GMT 2000


Someone out there was looking for a start/stop script for samba.  I have
often wondered why samba distribution didn't contain one.  Many a time I
have found myself writting this same script.  Again the other day when I
started playing around with samba-tng, I found myself writting the darn
thing.  It wasn't so bad to start stop samba by hand when there was only
two deamons, but now there seems to be a few more.  I am just too lazy
for that.

Sooo,  here is my feeble addition to the great wave that is
affectionately reffered to as SAMBA.

---
#!/sbin/sh
#
#
#  File    :  samba
#  Purpose :  Start/Stop script for Samba TNG
#
#
#
#  Modification History:
#
#  DATE           NAME                     COMMENTS
#  ------------   -----------------------
----------------------------------------------
#  2000-02-25     C. Roberts               Created.
#  2000-03-03     C. Roberts               modifed to Handel Multiple
damons
#
#
--------------------------------------------------------------------------------------

ROOTPATH=/opt/samba-tng
LIBPATH=${ROOTPATH}/lib
BINPATH=${ROOTPATH}/bin
LOCKPATH=${ROOTPATH}/var/locks

SMB_CMDS="smbd nmbd browserd lsarpcd netlogond samrd spoolssd srvsvcd
svcctld winregd wkssvcd"

# Make sure that our ROOTPATH is valid
[ ! -d ${ROOTPATH} ] && exit 1

case "$1" in
'start')
        if [ -f ${LIBPATH}/smb.conf ]; then

           # Start all the required deamons
           echo Starting Samba Background Daemons
           for CMD in ${SMB_CMDS} ; do
             if [ -f ${BINPATH}/${CMD} ]; then
#               echo "${CMD}"
               ${BINPATH}/${CMD}  -D
             fi
           done

        fi
        ;;

'stop')

#
#
#  Should probably be using smbstatus -p  but it doesn't seem to be
working in the TNG branch
#

        echo Stopping Samba Background Daemons
        for CMD in ${SMB_CMDS} ; do
          PIDFILE=${LOCKPATH}/${CMD}.pid
          if [ -f ${PIDFILE} ]; then
#             echo "${CMD}"
             killpid=`/usr/bin/cat ${PIDFILE}`
             [ "$killpid" -gt 0 ] && kill -15 $killpid
          fi
        done
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

#
#  END OF FILE
#
----




More information about the samba-ntdom mailing list