Are there limitations on what commands can be in the before.sh or after.sh scripts on the Secondary / Passive server when using failover?

EscondidoAdmin

Premier Customer
Basic Certified
Joined
Apr 9, 2024
Messages
91
Reaction score
19
Lab system - 3Cx v20u4, Ent, On Prem, Linux, 4sc with failover

We have failover mostly working in our 3CX Lab environment but have a couple of issues. One such issue is if we put any commands in the before.sh like to echo some log entries into a temp file, then the Secondary / Passive never completes the failover - it stays Secondary / Passive and phones can't register to it. If we don't have a before.sh, on failover the Secondary machine becomes Secondary / Active and phone registration happens just fine.

In addition to the Secondary never becoming Active if we have the commands shown below in the before.sh file, we never see any entries in the temp file the shell script should write to. If we run the shell script from the Linus command line, it does write to the temp file and shut down the Primary as expected.

Are we using a command that's not acceptable?

Here's an example of the before.sh script that seems to prevent the Secondary from becoming Active:
echo " " >> /tmp/3cxfailover.log
echo " " >> /tmp/3cxfailover.log
echo "+++++++++++++++++++++++++++" >> /tmp/3cxfailover.log
echo "before.sh ran at: " `date` >> /tmp/3cxfailover.log
echo `ps -ef | grep -i 3cx` >> /tmp/3cxfailover.log
#Shutdown master PBX, actual IP not shown here
ssh -t [email protected] sudo /usr/sbin/shutdown now
#write log on Primary
echo "************" >> /tmp/3cxfailover.log
echo `date` >> /tmp/3cxfailover.log
exit 0
echo "===========================" >> /tmp/3cxfailover.log
 
Update: through trial and error (mostly error!), we notice that if we configured the Secondary with a before.sh file, regardless of what's in it, the failover from Primary to Secondary doesn't complete. The Secondary's services never start and the role never changes to Active when we have a before.sh configured.

Does anybody know where log files on the Secondary are that would have messages about what happened with running before.sh and why the services haven't started.

To be clear: if we don't configure the Secondary to run a before script, then in response to causing a failover, the Secondary changes from Passive to Active. If we do have a before script, the Secondary never change to Active.

We had three eyes watching when we configured the Failover. Same for the commands in sections 1 through 3 of the "Linux Failover Scripts" document. We're using Route 53 for our public DNS so section 4 doesn't apply. We're pretty sure we got everything right - we can manually run the example Shutdown3CXMainMachine.sh script from the command line and it'll successfully shut down the Primary.

I'll try re-running the failover config commands from "Linux Failover Scripts" just in case...

Thoughts on why we're seeing this behavior and where useful logs to troubleshoot might be?

Thanks,
 
Bump... Anybody?

Restating the issue:
- We've successfully configured failover in our lab.
- If we don't specify any BEFORE or AFTER scripts (by definition on the Secondary - Passive), stopping the SIP Service on the Primary - Active server successfully fails over and the Secondary becomes active.
- If we have a before.sh shell script defined and uploaded in the Backup -> Failover -> BEFORE field on the Secondary - Passive server, when we stop the SIP Service on the Primary - Active, the Secondary never becomes Active.
- The before.sh script will run fine from the Linux command line, so we assume it's good. Even if we just have a simple command that echos a date string into the /tmp directory, having a before.sh script defined causes the failover to complete.

What we're looking for:
1) Is anybody successfully using a before.sh script for failover?
2) Any suggestions as to why we're seeing the above failure to complete failover?
3) We've searched through the Support Package and syslog messages but aren't finding any references to the before.sh script. Anybody know where we can see failover failure messages logged?

Thanks,
 

Latest Posts

Forum statistics

Threads
111,964
Messages
590,004
Members
164,869
Latest member
hpgitsupport