From f75e781e8e8889caf615c7cbbd7fd4625049cee0 Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Tue, 30 Nov 2021 18:14:31 -0500 Subject: [PATCH] added logic to wait for backup host to come back online before trying carp sync --- opnsense-carp-dhcp.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/opnsense-carp-dhcp.php b/opnsense-carp-dhcp.php index fc3a7bb..71f9762 100644 --- a/opnsense-carp-dhcp.php +++ b/opnsense-carp-dhcp.php @@ -182,6 +182,16 @@ sleep(30); # try to sync carp settings to backup node/router printf("Starting the CARP Sync. \n"); +printf("Trying to ping sync host, %s. \n", $syncIP); +while (true) { + exec("ping -c 4 " . $syncIP, $output, $result); + if ($result == 0) { + printf("Ping is successful. \n"); + break; + } else { + printf("Ping unsuccessful. \n"); + } +} $syncStatus = trim(shell_exec('configctl system ha_reconfigure_backup')); printf("CARP Sync Status: %s. \n", $syncStatus); printf("finished the CARP Sync. \n");