s3-spoolss: fix notify_printer_status_byname.
[Samba.git] / packaging / Debian / debian-sarge / samba.init
blob5d0f4671a00c954c5daa4b8ed734c68d44883ed3
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 # See if the daemons are there
20 test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
22 case "$1" in
23 start)
24 echo -n "Starting Samba daemons:"
26 echo -n " nmbd"
27 start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- -D
29 if [ "$RUN_MODE" != "inetd" ]; then
30 echo -n " smbd"
31 start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- -D
34 echo "."
36 stop)
37 echo -n "Stopping Samba daemons: "
39 start-stop-daemon --stop --quiet --pidfile $NMBDPID
40 # Wait a little and remove stale PID file
41 sleep 1
42 if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
43 then
44 # Stale PID file (nmbd was succesfully stopped),
45 # remove it (should be removed by nmbd itself IMHO.)
46 rm -f $NMBDPID
48 echo -n "nmbd"
50 if [ "$RUN_MODE" != "inetd" ]; then
51 start-stop-daemon --stop --quiet --pidfile $SMBDPID
52 # Wait a little and remove stale PID file
53 sleep 1
54 if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
55 then
56 # Stale PID file (nmbd was succesfully stopped),
57 # remove it (should be removed by smbd itself IMHO.)
58 rm -f $SMBDPID
60 echo -n " smbd"
63 echo "."
66 reload)
67 echo -n "Reloading /etc/samba/smb.conf (smbd only)"
68 start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
70 echo "."
72 restart|force-reload)
73 $0 stop
74 sleep 1
75 $0 start
78 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"
79 exit 1
81 esac
83 exit 0