clean up if {} statement to keep in sync with HEAD
[Samba.git] / packaging / Debian / debian / samba.init
blob0ad8bc07e139886f54794c2444672227c4ae77c1
1 #!/bin/sh
3 # Start/stops the Samba daemons (nmbd and smbd).
7 # Defaults
8 RUN_MODE="daemons"
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
17 unset TMPDIR
19 # If Samba is running from inetd then there is nothing to do
20 if [ "$RUN_MODE" = "inetd" ]; then
21 # Commented out to close bug #26884 (startup message is rather long). I
22 # have yet to think how to let the user know that if he/she is running
23 # Samba from inetd, he can't just "/etc/init.d/samba stop" to stop
24 # the Samba daemons.
25 # echo "Warning: Samba is not running as daemons. Daemons not restarted/stopped."
26 # echo "Daemons will start automatically by inetd (if you wanted to start Samba)."
27 # echo "If you want to stop Samba, get the PID's of all nmbd and smbd processes"
28 # echo "and send them a SIGTERM signal but keep in mind that inetd could restart them."
29 exit 0
32 # See if the daemons are there
33 test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
35 case "$1" in
36 start)
37 echo -n "Starting Samba daemons:"
39 echo -n " nmbd"
40 start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- -D
42 echo -n " smbd"
43 start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- -D
45 echo "."
47 stop)
48 echo -n "Stopping Samba daemons:"
50 echo -n " nmbd"
51 start-stop-daemon --stop --quiet --pidfile $NMBDPID
53 echo -n " smbd"
54 start-stop-daemon --stop --quiet --pidfile $SMBDPID
56 echo "."
58 reload)
59 echo -n "Reloading /etc/samba/smb.conf (smbd only)"
60 start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
62 echo "."
64 restart|force-reload)
65 echo -n "Restarting Samba daemons:"
67 echo -n " nmbd"
68 start-stop-daemon --stop --quiet --pidfile $NMBDPID
69 sleep 2
70 start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- -D
72 echo -n " smbd"
73 start-stop-daemon --stop --quiet --pidfile $SMBDPID
74 sleep 2
75 start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- -D
77 echo "."
80 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"
81 exit 1
83 esac
85 exit 0