4 # description: Starts and stops the Samba smbd and nmbd daemons \
5 # used to provide SMB network services.
7 # pidfile: /var/run/samba/smbd.pid
8 # pidfile: /var/run/samba/nmbd.pid
9 # config: /etc/samba/smb.conf
12 # Source function library.
13 if [ -f /etc/init.d/functions ] ; then
14 . /etc/init.d/functions
15 elif [ -f /etc/rc.d/init.d/functions ] ; then
16 . /etc/rc.d/init.d/functions
21 # Avoid using root's TMPDIR
24 # Source networking configuration.
25 . /etc/sysconfig/network
27 # Don't start NMBD by default.
28 # This can be overridden in /etc/sysconfig/samba .
31 if [ -f /etc/sysconfig/samba ]; then
32 . /etc/sysconfig/samba
35 # be friendly - convert the value to lower case
36 START_NMBD=$(echo $START_NMBD | tr A-Z a-z)
38 # Check that networking is up.
39 [ ${NETWORKING} = "no" ] && exit 0
41 # Check that smb.conf exists.
42 [ -f /etc/samba/smb.conf ] || exit 0
44 # Check that we can write to it... so non-root users stop here
45 [ -w /etc/samba/smb.conf ] || exit 0
52 echo -n $"Starting $KIND services: "
53 daemon smbd $SMBDOPTIONS
57 if [ x"$START_NMBD" = x"yes" ]; then
58 echo -n $"Starting $KIND services: "
59 daemon nmbd $NMBDOPTIONS
62 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \
65 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb || \
73 echo -n $"Shutting down $KIND services: "
76 [ $RETVAL -eq 0 ] && rm -f /var/run/smbd.pid
79 if [ x"$START_NMBD" = x"yes" ]; then
80 echo -n $"Shutting down $KIND services: "
83 [ $RETVAL2 -eq 0 ] && rm -f /var/run/nmbd.pid
84 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
87 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smb
99 echo -n $"Reloading smb.conf file: "
128 [ -f /var/lock/subsys/smb ] && restart || :
131 echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"