]> git.pld-linux.org Git - packages/samba.git/blob - winbind.init
- use functions
[packages/samba.git] / winbind.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 91 35
4 # description:  Starts and stops the Samba winbind daemon to provide\
5 #               user and group information from a NT domain controller to linux.
6 #
7 # config:       /etc/samba/smb.conf
8
9 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
10
11 # Source function library.
12 . /etc/rc.d/init.d/functions
13
14 # Source networking configuration.
15 . /etc/sysconfig/network
16
17 # Daemon specific configuration.
18 . /etc/sysconfig/winbind
19
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23                 msg_network_down winbindd
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29
30 TMPDIR="/tmp"; export TMPDIR
31
32 # Check that smb.conf exists.
33 [ -f /etc/samba/smb.conf ] || exit 0
34
35 start() {
36         if [ ! -f /var/lock/subsys/winbind ]; then
37                 if [ "`grep -i 'idmap uid' /etc/samba/smb.conf | egrep -v [\#\;]`" -a "`grep -i 'idmap gid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then
38                         msg_starting winbindd
39                         daemon winbindd
40                         RETVAL=$?
41                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \
42                         RETVAL=1
43                 else
44                         nls "Winbind is not configured in /etc/samba/smb.conf, not starting"
45                 fi
46         else
47                 msg_already_running winbindd
48         fi
49 }
50
51 stop() {
52         if [ -f /var/lock/subsys/winbind ]; then
53                 msg_stopping winbindd
54                 killproc winbindd
55                 rm -f /var/lock/subsys/winbind >/dev/null 2>&1
56         else
57                 msg_not_running winbindd
58         fi
59 }
60
61 condrestart() {
62         if [ -f /var/lock/subsys/winbind ]; then
63                 stop
64                 start
65         else
66                 msg_not_running winbindd
67                 RETVAL=$1
68         fi
69 }
70
71 RETVAL=0
72 # See how we were called.
73 case "$1" in
74   start)
75         start
76         ;;
77   stop)
78         stop
79         ;;
80   restart)
81         stop
82         start
83         ;;
84   reload|force-reload)
85         if [ -f /var/lock/subsys/winbind ]; then
86                 msg_reloading winbindd
87                 killproc winbindd -HUP
88                 RETVAL=$?
89         else
90                 msg_not_running winbindd
91                 exit 7
92         fi
93         ;;
94   try-restart)
95         condrestart 0
96         ;;
97   status)
98         status winbindd
99         RETVAL=$?
100         ;;
101   *)
102         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
103         exit 3
104 esac
105
106 exit $RETVAL
This page took 0.030819 seconds and 4 git commands to generate.