moved the logic around to only sync when master node
This commit is contained in:
@@ -308,33 +308,34 @@ if ($carpStatus == "MASTER") {
|
||||
write_config_and_restart_services($wanInterface);
|
||||
|
||||
echo_write_log("Done Setting WAN to Static based on the DHCP information");
|
||||
|
||||
echo_write_log("Testing to see if this router is the HA sync master");
|
||||
if (filter_var($config['hasync']['synchronizetoip'], FILTER_VALIDATE_IP)) {
|
||||
echo_write_log("Sleeping for 30 seconds");
|
||||
sleep(30);
|
||||
|
||||
# try to sync CARP settings to backup node/router
|
||||
echo_write_log("Starting the CARP Sync");
|
||||
echo_write_log("Trying to ping sync host, " . $config['hasync']['synchronizetoip']);
|
||||
do {
|
||||
exec("ping -c 4 " . $config['hasync']['synchronizetoip'], $output, $result);
|
||||
if ($result == 0) {
|
||||
echo_write_log("Ping was successful");
|
||||
break;
|
||||
} else {
|
||||
echo_write_log("Ping was unsuccessful");
|
||||
}
|
||||
} while (true);
|
||||
|
||||
configd_run('filter sync');
|
||||
xmlrpc_exec('opnsense.configd_reload_all_templates');
|
||||
|
||||
echo_write_log("CARP Sync Status: " . $output);
|
||||
echo_write_log("finished the CARP Sync");
|
||||
} else {
|
||||
echo_write_log("Router is not the HA sync master");
|
||||
}
|
||||
} else {
|
||||
echo_write_log("Router is not currently CARP master, not updating");
|
||||
}
|
||||
echo_write_log("Testing to see if this router is the HA sync master");
|
||||
if (filter_var($config['hasync']['synchronizetoip'], FILTER_VALIDATE_IP)) {
|
||||
echo_write_log("Sleeping for 30 seconds");
|
||||
sleep(30);
|
||||
|
||||
# try to sync CARP settings to backup node/router
|
||||
echo_write_log("Starting the CARP Sync");
|
||||
echo_write_log("Trying to ping sync host, " . $config['hasync']['synchronizetoip']);
|
||||
do {
|
||||
exec("ping -c 4 " . $config['hasync']['synchronizetoip'], $output, $result);
|
||||
if ($result == 0) {
|
||||
echo_write_log("Ping was successful");
|
||||
break;
|
||||
} else {
|
||||
echo_write_log("Ping was unsuccessful");
|
||||
}
|
||||
} while (true);
|
||||
|
||||
configd_run('filter sync');
|
||||
xmlrpc_exec('opnsense.configd_reload_all_templates');
|
||||
|
||||
echo_write_log("CARP Sync Status: " . $output);
|
||||
echo_write_log("finished the CARP Sync");
|
||||
} else {
|
||||
echo_write_log("Router is not the HA sync master");
|
||||
}
|
||||
echo_write_log("End of Script " . $argv[0]);
|
||||
|
||||
Reference in New Issue
Block a user