Ensure we kill with -TERM.
[kai/samba.git] / packaging / RedHat / smb.init
1 #!/bin/sh
2 #
3 # chkconfig: 345 91 35
4 # description: Starts and stops the Samba smbd and nmbd daemons \
5 #              used to provide SMB network services.
6
7 # Source function library.
8 . /etc/rc.d/init.d/functions
9
10 # Source networking configuration.
11 . /etc/sysconfig/network
12
13 # Check that networking is up.
14 [ ${NETWORKING} = "no" ] && exit 0
15
16 CONFIG=/etc/samba/smb.conf
17
18 # Check that smb.conf exists.
19 [ -f $CONFIG ] || exit 0
20
21 # See how we were called.
22 case "$1" in
23   start)
24         echo -n "Starting SMB services: "
25         daemon smbd -D  
26         daemon nmbd -D 
27         if [ "`grep -i 'winbind uid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then
28                 daemon winbindd 
29         fi
30         echo
31         touch /var/lock/subsys/smb
32         ;;
33   stop)
34         echo -n "Shutting down SMB services: "
35         killproc smbd -TERM
36         killproc nmbd -TERM
37         if [ "`ps -ef | grep winbind | grep -v grep`" ]; then
38                 killproc winbindd
39         fi
40         rm -f /var/lock/subsys/smb
41         echo ""
42         ;;
43   status)
44         status smbd
45         status nmbd
46         status winbindd
47         ;;
48   restart)
49         echo -n "Restarting SMB services: "
50         $0 stop
51         $0 start
52         echo "done."
53         ;;
54   *)
55         echo "Usage: smb {start|stop|restart|status}"
56         exit 1
57 esac
58