summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-12-04 13:05:04 +0100
committerGitHub <noreply@github.com>2020-12-04 13:05:04 +0100
commit2657cb39aa03a5908ce6d61c58f384131c247d71 (patch)
tree27bfd2ddc5556df0b98eaa49f351b15b5ec88fc1 /python
parent621f85524fee2846aa5bfd25f7e961d72ede0d5d (diff)
parent1a4fa2ff7e196492ce2fd63534ae93ffa249ff33 (diff)
downloadvyos-1x-2657cb39aa03a5908ce6d61c58f384131c247d71.tar.gz
vyos-1x-2657cb39aa03a5908ce6d61c58f384131c247d71.zip
Merge pull request #634 from DmitriyEshenko/1x-crux-pim01
pim: igmp: igmp-proxy: T2744: Add check to prevent pimd and igmp-prox…
Diffstat (limited to 'python')
-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