4 # Start/stops the Samba daemon (smbd).
5 # Adapted from the Samba 3 packages.
8 SMBDPID
=/var
/run
/samba
/smbd.pid
10 # clear conflicting settings from the environment
13 # See if the daemon and the config file are there
14 test -x /usr
/sbin
/smbd
-a -r /etc
/samba
/smb.conf ||
exit 0
16 .
/lib
/lsb
/init-functions
20 log_daemon_msg
"Starting Samba 4 daemon" "smbd"
22 if ! start-stop-daemon
--start --quiet --oknodo --exec /usr
/sbin
/smbd
-- -D; then
30 log_daemon_msg
"Stopping Samba 4 daemon" "smbd"
32 start-stop-daemon
--stop --quiet --pidfile $SMBDPID
33 # Wait a little and remove stale PID file
35 if [ -f $SMBDPID ] && ! ps h
`cat $SMBDPID` > /dev
/null
37 # Stale PID file (smbd was succesfully stopped),
38 # remove it (should be removed by smbd itself IMHO.)
46 log_daemon_msg
"Reloading /etc/samba/smb.conf" "smbd only"
48 start-stop-daemon
--stop --signal HUP
--pidfile $SMBDPID
58 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"