This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[kai/samba.git] / packaging / RedHat / winbind.init
1 #!/bin/sh
2 #
3 # chkconfig: 345 81 45
4 # description: Starts and stops the Samba winbind daemon to provide \
5 # user and group information from a domain controller to linux.
6
7 # Source function library.
8 if [ -f /etc/init.d/functions ] ; then
9   . /etc/init.d/functions
10 elif [ -f /etc/rc.d/init.d/functions ] ; then
11   . /etc/rc.d/init.d/functions
12 else
13   exit 0
14 fi
15
16 # Source networking configuration.
17 . /etc/sysconfig/network
18
19 # Check that networking is up.
20 [ ${NETWORKING} = "no" ] && exit 0
21
22 # Check that smb.conf exists.
23 [ -f /etc/samba/smb.conf ] || exit 0
24
25 RETVAL=0
26
27
28 start() {
29         echo -n "Starting Winbind services: "
30         RETVAL=1
31         if [ "`grep -i 'winbind uid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then
32                 daemon winbindd
33                 RETVAL=$?
34         fi
35         echo
36         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \
37            RETVAL=1
38         return $RETVAL
39 }       
40 stop() {
41         echo -n "Shutting down Winbind services: "
42         RETVAL=1
43         if [ "`grep -i 'winbind uid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then
44                 killproc winbindd
45                 RETVAL=$?
46         fi
47         echo
48         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/winbind
49         return $RETVAL
50 }       
51 restart() {
52         stop
53         start
54 }       
55 reload() {
56         export TMPDIR="/var/tmp"
57         echo -n "Checking domain trusts: "
58         killproc winbindd -HUP
59         RETVAL=$?
60         echo
61         return $RETVAL
62 }       
63 mdkstatus() {
64         status winbindd
65 }       
66
67 case "$1" in
68   start)
69         start
70         ;;
71   stop)
72         stop
73         ;;
74   restart)
75         restart
76         ;;
77   reload)
78         reload
79         ;;
80   status)
81         mdkstatus
82         ;;
83   condrestart)
84         [ -f /var/lock/subsys/winbindd ] && restart || :
85         ;;
86   *)
87         echo "Usage: $0 {start|stop|restart|status|condrestart}"
88         exit 1
89 esac
90
91 exit $?