3 # Start/stops the Samba daemons (nmbd and smbd).
10 # Reads config file (will override defaults above)
11 [ -r /etc/default/samba ] && . /etc/default/samba
14 NMBDPID=$PIDDIR/nmbd.pid
15 SMBDPID=$PIDDIR/smbd.pid
17 # clear conflicting settings from the environment
20 # See if the daemons are there
21 test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
25 echo -n "Starting Samba daemons..."
27 # Make sure we have our PIDDIR, even if it's on a tmpfs
29 chown root:root $PIDDIR
32 if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D; then
37 if [ "$RUN_MODE" != "inetd" ]; then
38 #log_progress_msg "smbd"
39 if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then
48 echo -n "Stopping Samba daemons..."
50 start-stop-daemon --stop --quiet --pidfile $NMBDPID
51 # Wait a little and remove stale PID file
53 if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
55 # Stale PID file (nmbd was succesfully stopped),
56 # remove it (should be removed by nmbd itself IMHO.)
60 if [ "$RUN_MODE" != "inetd" ]; then
61 #log_progress_msg "smbd"
62 start-stop-daemon --stop --quiet --pidfile $SMBDPID
63 # Wait a little and remove stale PID file
65 if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
67 # Stale PID file (nmbd was succesfully stopped),
68 # remove it (should be removed by smbd itself IMHO.)
77 echo -n "Reloading /etc/samba/smb.conf..."
79 start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
89 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"