blob: df2d8b23cdba1e8cb133db9dfe38ac5294aca7c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/bin/sh
# ctdb event script for Samba
PATH=/bin:/usr/bin:$PATH
. /etc/ctdb/functions
loadconfig ctdb
cmd="$1"
shift
[ "$CTDB_MANAGES_SAMBA" = "yes" ] || exit 0
case $cmd in
startup)
# wait for all shared directories to become available
smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
ctdb_wait_directories "Samba" $smb_dirs
# make sure samba is not already started
service smb stop > /dev/null 2>&1
service winbind stop > /dev/null 2>&1
# start Samba service. Start it reniced, as under very heavy load
# the number of smbd processes will mean that it leaves few cycles for
# anything else
nice service smb start
service winbind start
# wait for the Samba tcp ports to become available
smb_ports=`testparm -sv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2`
ctdb_wait_tcp_ports "Samba" $smb_ports
# wait for winbind to be ready
ctdb_wait_command "winbind" "wbinfo -p"
;;
takeip)
# nothing special for Samba
;;
releaseip)
# nothing special for Samba
;;
recovered)
# nothing special for Samba
exit 0
;;
shutdown)
# shutdown Samba when ctdb goes down
service smb stop
service winbind stop
;;
monitor)
testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
echo "`date` ERROR: testparm shows smb.conf is not clean"
exit 1
}
smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
ctdb_check_directories "Samba" $smb_dirs
smb_ports=`testparm -sv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2`
ctdb_check_tcp_ports "Samba" $smb_ports
;;
esac
# ignore unknown commands
exit 0
|