]>
Commit | Line | Data |
---|---|---|
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 | msg_starting winbindd | |
38 | daemon /usr/sbin/winbindd | |
39 | RETVAL=$? | |
40 | if [ $RETVAL -eq 0 ]; then | |
41 | touch /var/lock/subsys/winbind | |
42 | RETVAL=1 | |
43 | fi | |
44 | else | |
45 | msg_already_running winbindd | |
46 | fi | |
47 | } | |
48 | ||
49 | stop() { | |
50 | if [ -f /var/lock/subsys/winbind ]; then | |
51 | msg_stopping winbindd | |
52 | killproc winbindd | |
53 | rm -f /var/lock/subsys/winbind >/dev/null 2>&1 | |
54 | else | |
55 | msg_not_running winbindd | |
56 | fi | |
57 | } | |
58 | ||
59 | condrestart() { | |
60 | if [ -f /var/lock/subsys/winbind ]; then | |
61 | stop | |
62 | start | |
63 | else | |
64 | msg_not_running winbindd | |
65 | RETVAL=$1 | |
66 | fi | |
67 | } | |
68 | ||
69 | RETVAL=0 | |
70 | # See how we were called. | |
71 | case "$1" in | |
72 | start) | |
73 | start | |
74 | ;; | |
75 | stop) | |
76 | stop | |
77 | ;; | |
78 | restart) | |
79 | stop | |
80 | start | |
81 | ;; | |
82 | reload|force-reload) | |
83 | if [ -f /var/lock/subsys/winbind ]; then | |
84 | msg_reloading winbindd | |
85 | killproc winbindd -HUP | |
86 | RETVAL=$? | |
87 | else | |
88 | msg_not_running winbindd | |
89 | exit 7 | |
90 | fi | |
91 | ;; | |
92 | try-restart) | |
93 | condrestart 0 | |
94 | ;; | |
95 | status) | |
96 | status winbindd | |
97 | RETVAL=$? | |
98 | ;; | |
99 | *) | |
100 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" | |
101 | exit 3 | |
102 | esac | |
103 | ||
104 | exit $RETVAL |