r18827: I forgot to commit this:
[Samba.git] / packaging / debian / samba-server.samba.init
blob9b276dd65828bf78340c84e4610afb9c6bafcf06
1 #! /bin/sh
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
11 unset TMPDIR
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
18 case "$1" in
19 start)
20 log_daemon_msg "Starting Samba 4 daemon" "smbd"
22 if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then
23 log_end_msg 1
24 exit 1
27 log_end_msg 0
29 stop)
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
34 sleep 1
35 if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
36 then
37 # Stale PID file (smbd was succesfully stopped),
38 # remove it (should be removed by smbd itself IMHO.)
39 rm -f $SMBDPID
42 log_end_msg 0
45 reload)
46 log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only"
48 start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
50 log_end_msg 0
52 restart|force-reload)
53 $0 stop
54 sleep 1
55 $0 start
58 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"
59 exit 1
61 esac
63 exit 0