Zentyal Forum, Linux Small Business Server

Zentyal Server => Installation and Upgrades => Topic started by: Gilberto Ferreira on November 06, 2019, 12:53:35 pm

Title: Zentyal 4 HA
Post by: Gilberto Ferreira on November 06, 2019, 12:53:35 pm
Hi there

I have set two servers, working with HA and so far so good... I have tested powered off one server and the secondary server got the IP and DHCP services...  But, when secondary server assume this services, I needed to restart samba manually, in order to get backup folders shares work properly. So my question is, how can I set samba into HA service like ip or dhcp does, in order to samba restart automatic when primary server gone away?
I also tryied to use hooks scripts but when do so, the DHCP return fail status in crm_mon 1

Thanks for any kind of help!
Title: Re: Zentyal 4 HA
Post by: Gilberto Ferreira on November 07, 2019, 12:59:37 pm
I managed to solved this issue, creating the script bellow:

#!/bin/bash


statusip=$(crm_mon -1 | grep IPHALOCAL | grep servidor2)

status="$?"

echo $status

if [[ $status -eq 1 ]]
then
 echo "That's great :-)"
elif [[ $status -eq 0 ]]
then
 echo "(exit status=$status)"
/etc/init.d/samba force-reload
fi

And add to crontab, to run every minute...