added logic to wait for backup host to come back online before trying carp sync

This commit is contained in:
2021-11-30 18:14:31 -05:00
parent b730d1e1a0
commit f75e781e8e

View File

@@ -182,6 +182,16 @@ sleep(30);
# try to sync carp settings to backup node/router # try to sync carp settings to backup node/router
printf("Starting the CARP Sync. \n"); 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')); $syncStatus = trim(shell_exec('configctl system ha_reconfigure_backup'));
printf("CARP Sync Status: %s. \n", $syncStatus); printf("CARP Sync Status: %s. \n", $syncStatus);
printf("finished the CARP Sync. \n"); printf("finished the CARP Sync. \n");