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 # If Samba is running from inetd then there is nothing to do
20 if [ "$RUN_MODE" = "inetd" ]; then
21 # INIT_VERSION is defined for scripts than run directly from init...
22 if [ "$INIT_VERSION" = "" ]; then
25 Warning: Samba is set to start from inetd; this script has no effect.
26 Run "dpkg-reconfigure samba" if you want Samba to be started and stopped
27 from this script. If you want to continue running Samba from inetd, you
28 should use "killall nmbd smbd" to restart the service, or update-inetd
29 to disable/reenable it.
36 # See if the daemons are there
37 test -x /usr
/sbin
/nmbd
-a -x /usr
/sbin
/smbd ||
exit 0
41 echo -n "Starting Samba daemons:"
44 start-stop-daemon
--start --quiet --exec /usr
/sbin
/nmbd
-- -D
47 start-stop-daemon
--start --quiet --exec /usr
/sbin
/smbd
-- -D
52 echo -n "Stopping Samba daemons: "
54 start-stop-daemon
--stop --quiet --pidfile $NMBDPID
55 # Wait a little and remove stale PID file
57 if [ -f $NMBDPID ] && ! ps h
`cat $NMBDPID` > /dev
/null
59 # Stale PID file (nmbd was succesfully stopped),
60 # remove it (should be removed by nmbd itself IMHO.)
65 start-stop-daemon
--stop --quiet --pidfile $SMBDPID
66 # Wait a little and remove stale PID file
68 if [ -f $SMBDPID ] && ! ps h
`cat $SMBDPID` > /dev
/null
70 # Stale PID file (nmbd was succesfully stopped),
71 # remove it (should be removed by smbd itself IMHO.)
78 echo -n "Reloading /etc/samba/smb.conf (smbd only)"
79 start-stop-daemon
--stop --signal HUP
--pidfile $SMBDPID
89 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"