1#!/bin/sh
2#
3# chkconfig: 345 91 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.
8if [ -f /etc/init.d/functions ] ; then
9  . /etc/init.d/functions
10elif [ -f /etc/rc.d/init.d/functions ] ; then
11  . /etc/rc.d/init.d/functions
12else
13  exit 0
14fi
15
16# Source networking configuration.
17. /etc/sysconfig/network
18
19# Check that networking is up.
20[ ${NETWORKING} = "no" ] && exit 0
21
22CONFIG=/etc/samba/smb.conf
23
24# Check that smb.conf exists.
25[ -f $CONFIG ] || exit 0
26
27start() {
28	echo -n "Starting Winbind services: "
29	daemon winbindd 
30	RETVAL=$?
31	echo
32	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \
33	   RETVAL=1
34	return $RETVAL
35}	
36stop() {
37	echo -n "Shutting down Winbind services: "
38	killproc winbindd
39	RETVAL=$?
40	echo
41	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/winbind
42	return $RETVAL
43}	
44restart() {
45	stop
46	start
47}	
48reload() {
49	export TMPDIR="/var/tmp"
50        echo -n "Checking domain trusts: "
51	killproc winbindd -HUP
52	RETVAL=$?
53	echo
54	return $RETVAL
55}	
56mdkstatus() {
57	status winbindd
58}	
59
60case "$1" in
61  start)
62  	start
63	;;
64  stop)
65  	stop
66	;;
67  restart)
68  	restart
69	;;
70  reload)
71  	reload
72	;;
73  status)
74  	mdkstatus
75	;;
76  condrestart)
77  	[ -f /var/lock/subsys/winbindd ] && restart || :
78	;;
79  *)
80	echo "Usage: $0 {start|stop|restart|status|condrestart}"
81	exit 1
82esac
83
84exit $?
85