2 # ctdb event script for Samba
4 PATH=/bin:/usr/bin:$PATH
12 [ "$CTDB_MANAGES_SAMBA" = "yes" ] || exit 0
16 # wait for all shared directories to become available
17 smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
18 ctdb_wait_directories "Samba" $smb_dirs
20 # make sure samba is not already started
21 service smb stop > /dev/null 2>&1
22 service winbind stop > /dev/null 2>&1
24 # start Samba service. Start it reniced, as under very heavy load
25 # the number of smbd processes will mean that it leaves few cycles for
27 nice service smb start
30 # wait for the Samba tcp ports to become available
31 smb_ports=`testparm -sv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2`
32 ctdb_wait_tcp_ports "Samba" $smb_ports
34 # wait for winbind to be ready
35 ctdb_wait_command "winbind" "wbinfo -p"
39 # nothing special for Samba
43 # nothing special for Samba
47 # nothing special for Samba
52 # shutdown Samba when ctdb goes down
58 testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
59 echo "`date` ERROR: testparm shows smb.conf is not clean"
63 smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
64 ctdb_check_directories "Samba" $smb_dirs
66 smb_ports=`testparm -sv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2`
67 ctdb_check_tcp_ports "Samba" $smb_ports
70 ctdb_check_command "winbind" "wbinfo -p"
75 # ignore unknown commands