]>
Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
bd52628c JB |
17 | # Daemon specific configuration. |
18 | . /etc/sysconfig/winbind | |
19 | ||
f9c55e20 | 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 | RETVAL=0 | |
36 | # See how we were called. | |
37 | case "$1" in | |
38 | start) | |
f9c55e20 | 39 | # Check if the service is already running? |
40 | if [ ! -f /var/lock/subsys/winbind ]; then | |
41 | if [ "`grep -i 'idmap uid' /etc/samba/smb.conf | egrep -v [\#\;]`" -a "`grep -i 'idmap gid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then | |
42 | msg_starting winbindd | |
bcb88b55 | 43 | daemon winbindd |
f9c55e20 | 44 | RETVAL=$? |
45 | [ $RETVAL -eq 0] && touch /var/lock/subsys/winbind || \ | |
46 | RETVAL=1 | |
edde306a | 47 | else |
48 | nls "Winbind is not configured in /etc/samba/smb.conf, not starting" | |
49 | fi | |
f9c55e20 | 50 | else |
51 | msg_already_running winbindd | |
52 | fi | |
53 | ;; | |
54 | stop) | |
55 | # Stop daemon. | |
56 | if [ -f /var/lock/subsys/winbind ]; then | |
57 | msg_stopping winbindd | |
58 | killproc winbindd | |
59 | rm -f /var/lock/subsys/winbind >/dev/null 2>&1 | |
60 | else | |
61 | msg_not_running winbindd | |
62 | fi | |
63 | ;; | |
64 | status) | |
65 | status winbindd | |
edde306a | 66 | RETVAL=$? |
f9c55e20 | 67 | ;; |
68 | restart) | |
69 | $0 stop | |
70 | $0 start | |
71 | exit $? | |
72 | ;; | |
73 | reload|force-reload) | |
74 | if [ -f /var/lock/subsys/winbind ]; then | |
75 | msg_reloading winbindd | |
76 | killproc winbindd -HUP | |
77 | RETVAL=$? | |
78 | else | |
79 | msg_not_running winbindd >&2 | |
80 | exit 7 | |
81 | fi | |
82 | ;; | |
83 | *) | |
84 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
85 | exit 3 | |
86 | esac | |
87 | ||
88 | exit $RETVAL |