trying to get HEAD building again. If you want the code
[tprouty/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 $CONFIG ] || exit 0
24
25 RETVAL=0
26
27 CONFIG=/usr/local/samba/lib/smb.conf
28 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/samba/sbin:/usr/local/samba/bin
29 export PATH
30
31
32 start() {
33         echo -n "Starting Winbind services: "
34         RETVAL=1
35         if [ "`egrep -i '(idmap.*uid|winbind.*uid)' $CONFIG | egrep -v [\#\;]`" ]; then
36                 daemon winbindd 
37                 RETVAL=$?
38         fi
39         echo
40         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \
41            RETVAL=1
42         return $RETVAL
43 }       
44 stop() {
45         echo -n "Shutting down Winbind services: "
46         RETVAL=1
47         if [ "`egrep -i '(idmap.*uid|winbind.*uid)' $CONFIG | egrep -v [\#\;]`" ]; then
48                 killproc winbindd
49                 RETVAL=$?
50         fi
51         echo
52         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/winbind
53         return $RETVAL
54 }       
55 restart() {
56         stop
57         start
58 }       
59 reload() {
60         export TMPDIR="/var/tmp"
61         echo -n "Checking domain trusts: "
62         killproc winbindd -HUP
63         RETVAL=$?
64         echo
65         return $RETVAL
66 }       
67 mdkstatus() {
68         status winbindd
69 }       
70
71 case "$1" in
72   start)
73         start
74         ;;
75   stop)
76         stop
77         ;;
78   restart)
79         restart
80         ;;
81   reload)
82         reload
83         ;;
84   status)
85         mdkstatus
86         ;;
87   condrestart)
88         [ -f /var/lock/subsys/winbindd ] && restart || :
89         ;;
90   *)
91         echo "Usage: $0 {start|stop|restart|status|condrestart}"
92         exit 1
93 esac
94
95 exit $?