system: refine gateway watcher service behaviour

Allow a (re)start and make it the "main" service.
This commit is contained in:
Franco Fichtner 2023-05-17 10:57:22 +02:00
parent b6c3ab45e7
commit 49a6b614a3

View File

@ -73,7 +73,8 @@ function dpinger_services()
$pconfig['verbose'] = false;
$pconfig['id'] = ':watcher:';
$pconfig['locked'] = true;
$services[] = $pconfig;
/* add as first entry which is used as "global" control */
array_unshift($services, $pconfig);
}
return $services;
@ -181,6 +182,11 @@ function dpinger_configure_do($verbose = false, $gwname = null, $bootup = false)
@unlink($process['socket']);
}
if (!empty($gwname) && $gwname == ':watcher:') {
/* allow the watcher to be restarted as well */
killbypid('/var/run/gateway_watcher.pid');
}
$ifconfig_details = legacy_interfaces_details();
$dpinger_default = dpinger_defaults();
$dpinger_instaces = dpinger_instances($ifconfig_details);