added --force|-f option to force script to run

This commit is contained in:
2021-12-01 15:43:07 -05:00
parent 8c2fcbf771
commit 86cdc09435

View File

@@ -38,6 +38,13 @@ $syncIP = $config['hasync']['synchronizetoip'];
# Start of Script #
###################
$force = false;
if (count($argv) > 1){
if ($argv[1] == "--force" or $argv[1] == "-f"){
$force = true;
}
}
function write_config_and_restart_services ($interface) {
write_config();
@@ -55,8 +62,12 @@ printf("Trying to ping sync host, %s. \n", $syncIP);
exec("ping -c 4 " . $syncIP, $output, $result);
if ($result == 0) {
printf("Ping is successful. No need to update. \n");
if ($force) {
printf("Force was passed in, so continuing with script. \n");
} else {
return;
}
}
printf("WAN Interface Name: %s \n", $wanInterface);