1#!/bin/sh
2#
3# chkconfig: - 91 35
4# description: Starts and stops the Samba winbind daemon
5#	       #
6# pidfile: /var/cache/samba/winbind.pid
7# config:  /etc/samba/smb.conf
8
9
10# Source function library.
11if [ -f /etc/init.d/functions ] ; then
12  . /etc/init.d/functions
13elif [ -f /etc/rc.d/init.d/functions ] ; then
14  . /etc/rc.d/init.d/functions
15else
16  exit 0
17fi
18
19# Avoid using root's TMPDIR
20unset TMPDIR
21
22# Source networking configuration.
23. /etc/sysconfig/network
24
25if [ -f /etc/sysconfig/samba ]; then
26   . /etc/sysconfig/samba
27fi
28
29# Check that networking is up.
30[ ${NETWORKING} = "no" ] && exit 0
31
32# Check that smb.conf exists.
33[ -f /etc/samba/smb.conf ] || exit 0
34
35RETVAL=0
36
37
38start() {
39        KIND="Winbind"
40	echo -n $"Starting $KIND services: "
41	daemon winbindd "$WINBINDOPTIONS"
42	RETVAL=$?
43	echo
44	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbindd || RETVAL=1
45	return $RETVAL
46}	
47
48stop() {
49        echo
50	KIND="Winbind"
51	echo -n $"Shutting down $KIND services: "
52	killproc winbindd -TERM
53	RETVAL=$?
54	[ $RETVAL -eq 0 ] && rm -f /var/run/winbindd.pid && rm -f /var/lock/subsys/winbindd
55	echo ""
56	return $RETVAL
57}	
58
59restart() {
60	stop
61	start
62}	
63
64reload() {
65        echo -n $"Reloading smb.conf file: "
66	killproc winbindd -HUP
67	RETVAL=$?
68	echo
69	return $RETVAL
70}	
71
72rhstatus() {
73	status winbindd
74}	
75
76case "$1" in
77  start)
78  	start
79	;;
80  stop)
81  	stop
82	;;
83  restart)
84  	restart
85	;;
86  reload)
87  	reload
88	;;
89  status)
90  	rhstatus
91	;;
92  condrestart)
93  	[ -f /var/lock/subsys/winbindd ] && restart || :
94	;;
95  *)
96	echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
97	exit 1
98esac
99
100exit $?
101