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
13 NMBDPID
=/var
/run
/samba
/nmbd.pid
14 SMBDPID
=/var
/run
/samba
/smbd.pid
16 # clear conflicting settings from the environment
19 # See if the daemons are there
20 test -x /usr
/sbin
/nmbd
-a -x /usr
/sbin
/smbd ||
exit 0
24 echo -n "Starting Samba daemons:"
27 start-stop-daemon
--start --quiet --exec /usr
/sbin
/nmbd
-- -D
29 if [ "$RUN_MODE" != "inetd" ]; then
31 start-stop-daemon
--start --quiet --exec /usr
/sbin
/smbd
-- -D
37 echo -n "Stopping Samba daemons: "
39 start-stop-daemon
--stop --quiet --pidfile $NMBDPID
40 # Wait a little and remove stale PID file
42 if [ -f $NMBDPID ] && ! ps h
`cat $NMBDPID` > /dev
/null
44 # Stale PID file (nmbd was succesfully stopped),
45 # remove it (should be removed by nmbd itself IMHO.)
50 if [ "$RUN_MODE" != "inetd" ]; then
51 start-stop-daemon
--stop --quiet --pidfile $SMBDPID
52 # Wait a little and remove stale PID file
54 if [ -f $SMBDPID ] && ! ps h
`cat $SMBDPID` > /dev
/null
56 # Stale PID file (nmbd was succesfully stopped),
57 # remove it (should be removed by smbd itself IMHO.)
67 echo -n "Reloading /etc/samba/smb.conf (smbd only)"
68 start-stop-daemon
--stop --signal HUP
--pidfile $SMBDPID
78 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"