summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
diff options
context:
space:
mode:
authorDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-12-04 11:40:02 +0000
committerDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-12-04 11:40:02 +0000
commit1a4fa2ff7e196492ce2fd63534ae93ffa249ff33 (patch)
tree27bfd2ddc5556df0b98eaa49f351b15b5ec88fc1 /python/vyos/util.py
parent621f85524fee2846aa5bfd25f7e961d72ede0d5d (diff)
downloadvyos-1x-1a4fa2ff7e196492ce2fd63534ae93ffa249ff33.tar.gz
vyos-1x-1a4fa2ff7e196492ce2fd63534ae93ffa249ff33.zip
pim: igmp: igmp-proxy: T2744: Add check to prevent pimd and igmp-proxy conflict
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r--python/vyos/util.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index d2e58bef2..cc7ce5b40 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -191,3 +191,12 @@ def ask_yes_no(question, default=False) -> bool:
return False
else:
sys.stdout.write("Please respond with yes/y or no/n\n")
+
+def process_named_running(name):
+ """ Checks if process with given name is running and returns its PID.
+ If Process is not running, return None
+ """
+ for p in psutil.process_iter():
+ if name in p.name():
+ return p.pid
+ return None