Debian packaging updates from Eloy
[Samba.git] / packaging / Debian / debian / samba.init
blob4d0a6b22096ad027255e85476b4dc5162da39dd3
1 #!/bin/sh
3 # Start/stops the Samba daemons (nmbd and smbd).
5 # $Id: samba.init,v 1.1.2.5 2002/10/15 17:20:02 jerry Exp $
8 # Defaults
9 RUN_MODE="daemons"
11 # Reads config file (will override defaults above)
12 [ -r /etc/default/samba ] && . /etc/default/samba
14 NMBDPID=/var/run/samba/nmbd.pid
15 SMBDPID=/var/run/samba/smbd.pid
17 # clear conflicting settings from the environment
18 unset TMPDIR
20 # If Samba is running from inetd then there is nothing to do
21 if [ "$RUN_MODE" = "inetd" ]; then
22 # Commented out to close bug #26884 (startup message is rather long). I
23 # have yet to think how to let the user know that if he/she is running
24 # Samba from inetd, he can't just "/etc/init.d/samba stop" to stop
25 # the Samba daemons.
26 # echo "Warning: Samba is not running as daemons. Daemons not restarted/stopped."
27 # echo "Daemons will start automatically by inetd (if you wanted to start Samba)."
28 # echo "If you want to stop Samba, get the PID's of all nmbd and smbd processes"
29 # echo "and send them a SIGTERM signal but keep in mind that inetd could restart them."
30 exit 0
33 # See if the daemons are there
34 test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
36 case "$1" in
37 start)
38 echo -n "Starting Samba daemons:"
40 echo -n " nmbd"
41 start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- -D
43 echo -n " smbd"
44 start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- -D
46 echo "."
48 stop)
49 echo -n "Stopping Samba daemons:"
51 echo -n " nmbd"
52 start-stop-daemon --stop --quiet --pidfile $NMBDPID
54 echo -n " smbd"
55 start-stop-daemon --stop --quiet --pidfile $SMBDPID
57 echo "."
59 reload)
60 echo -n "Reloading /etc/samba/smb.conf (smbd only)"
61 start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
63 echo "."
65 restart|force-reload)
66 echo -n "Restarting Samba daemons:"
68 echo -n " nmbd"
69 start-stop-daemon --stop --quiet --pidfile $NMBDPID
70 sleep 2
71 start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- -D
73 echo -n " smbd"
74 start-stop-daemon --stop --quiet --pidfile $SMBDPID
75 sleep 2
76 start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- -D
78 echo "."
81 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"
82 exit 1
84 esac
86 exit 0