sync with HEAD
[Samba.git] / packaging / RedHat / winbind.init
blob291c351df3aa7ed13961d15b963b9165b9bb1e86
1 #!/bin/sh
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.
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
16 # Source networking configuration.
17 . /etc/sysconfig/network
19 # Check that networking is up.
20 [ ${NETWORKING} = "no" ] && exit 0
22 # Check that smb.conf exists.
23 [ -f /etc/samba/smb.conf ] || exit 0
25 RETVAL=0
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=$?
35 echo
36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \
37 RETVAL=1
38 return $RETVAL
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=$?
47 echo
48 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/winbind
49 return $RETVAL
51 restart() {
52 stop
53 start
55 reload() {
56 export TMPDIR="/var/tmp"
57 echo -n "Checking domain trusts: "
58 killproc winbindd -HUP
59 RETVAL=$?
60 echo
61 return $RETVAL
63 mdkstatus() {
64 status winbindd
67 case "$1" in
68 start)
69 start
71 stop)
72 stop
74 restart)
75 restart
77 reload)
78 reload
80 status)
81 mdkstatus
83 condrestart)
84 [ -f /var/lock/subsys/winbindd ] && restart || :
87 echo "Usage: $0 {start|stop|restart|status|condrestart}"
88 exit 1
89 esac
91 exit $?