]> git.pld-linux.org Git - packages/samba.git/blame - winbind.init
- BR: keyutils-devel (this time it's explicitly required by configure)
[packages/samba.git] / winbind.init
CommitLineData
f9c55e20 1#!/bin/sh
2#
3# chkconfig: 345 91 35
bcb88b55 4# description: Starts and stops the Samba winbind daemon to provide\
f9c55e20 5# user and group information from a NT domain controller to linux.
6#
7# config: /etc/samba/smb.conf
8
9export 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
bd52628c
JB
17# Daemon specific configuration.
18. /etc/sysconfig/winbind
19
f9c55e20 20# Check that networking is up.
21if 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
26else
27 exit 0
28fi
29
30TMPDIR="/tmp"; export TMPDIR
31
32# Check that smb.conf exists.
33[ -f /etc/samba/smb.conf ] || exit 0
34
85b8cabe
ER
35# return true if 'idmap uid' or 'idmap gid' is set in samba config
36configtest() {
4e567386 37 egrep -qi '^idmap [ug]id' /etc/samba/smb.conf
85b8cabe
ER
38}
39
81e39ecc 40start() {
f9c55e20 41 if [ ! -f /var/lock/subsys/winbind ]; then
85b8cabe 42 if configtest; then
f9c55e20 43 msg_starting winbindd
85b8cabe 44 daemon /usr/sbin/winbindd
f9c55e20 45 RETVAL=$?
85b8cabe
ER
46 if [ $RETVAL -eq 0 ]; then
47 touch /var/lock/subsys/winbind
48 RETVAL=1
49 fi
edde306a 50 else
51 nls "Winbind is not configured in /etc/samba/smb.conf, not starting"
52 fi
f9c55e20 53 else
54 msg_already_running winbindd
55 fi
81e39ecc
JB
56}
57
58stop() {
f9c55e20 59 if [ -f /var/lock/subsys/winbind ]; then
60 msg_stopping winbindd
61 killproc winbindd
62 rm -f /var/lock/subsys/winbind >/dev/null 2>&1
63 else
64 msg_not_running winbindd
65 fi
81e39ecc
JB
66}
67
68condrestart() {
69 if [ -f /var/lock/subsys/winbind ]; then
70 stop
71 start
72 else
73 msg_not_running winbindd
74 RETVAL=$1
75 fi
76}
77
78RETVAL=0
79# See how we were called.
80case "$1" in
81 start)
82 start
f9c55e20 83 ;;
81e39ecc
JB
84 stop)
85 stop
f9c55e20 86 ;;
87 restart)
81e39ecc
JB
88 stop
89 start
f9c55e20 90 ;;
91 reload|force-reload)
92 if [ -f /var/lock/subsys/winbind ]; then
93 msg_reloading winbindd
94 killproc winbindd -HUP
95 RETVAL=$?
96 else
d8c915ae 97 msg_not_running winbindd
f9c55e20 98 exit 7
99 fi
100 ;;
81e39ecc
JB
101 try-restart)
102 condrestart 0
103 ;;
104 status)
105 status winbindd
106 RETVAL=$?
107 ;;
f9c55e20 108 *)
81e39ecc 109 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
f9c55e20 110 exit 3
111esac
112
113exit $RETVAL
This page took 0.07129 seconds and 4 git commands to generate.