From 49a6b614a3d353ff77d1ae030ae8bf4a11ae6c9a Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 17 May 2023 10:57:22 +0200 Subject: [PATCH] system: refine gateway watcher service behaviour Allow a (re)start and make it the "main" service. --- src/etc/inc/plugins.inc.d/dpinger.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/etc/inc/plugins.inc.d/dpinger.inc b/src/etc/inc/plugins.inc.d/dpinger.inc index f7d15c98b..9cc72d98c 100644 --- a/src/etc/inc/plugins.inc.d/dpinger.inc +++ b/src/etc/inc/plugins.inc.d/dpinger.inc @@ -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);