summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-15 22:03:09 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-15 22:03:09 +0200
commit16b2fc8fc4cae96f027e036f259c10dc793bf5e5 (patch)
treedb6b6987e168137ed24c8fa8b6a15cabec096050 /python
parentb5de1daab68d223174476f653f5a591c1e0e4de6 (diff)
downloadvyos-1x-16b2fc8fc4cae96f027e036f259c10dc793bf5e5.tar.gz
vyos-1x-16b2fc8fc4cae96f027e036f259c10dc793bf5e5.zip
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"
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py11
1 files changed, 11 insertions, 0 deletions
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