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