From 16b2fc8fc4cae96f027e036f259c10dc793bf5e5 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 15 Apr 2020 22:03:09 +0200 Subject: dns-forwarding: T2298: fix path to control file After migrating PowerDNS to systemd and also its configuration files to a volatile directory in commit 77d725f ("dns-forwarding: T2185: move configuration files to volatile /run directory") the path for the control file has not been altered and pushed to the client rec_control binary" --- python/vyos/util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'python') diff --git a/python/vyos/util.py b/python/vyos/util.py index 49c47cd85..7558bd3b1 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -268,6 +268,17 @@ def process_running(pid_file): return pid_exists(int(pid)) +def process_named_running(name): + """ Checks if process with given name is running and returns its PID. + If Process is not running, return None + """ + from psutil import process_iter + for p in process_iter(): + if name in p.name(): + return p.pid + return None + + def seconds_to_human(s, separator=""): """ Converts number of seconds passed to a human-readable interval such as 1w4d18h35m59s -- cgit v1.2.3