From 7e33f07ebff41261b47b4ef8123c9dfa616099db Mon Sep 17 00:00:00 2001 From: wuzhaomin Date: Fri, 5 Jul 2024 16:04:25 +0800 Subject: [PATCH] The pid_list function is added to the conf_check.py file --- common/conf_check.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/conf_check.py b/common/conf_check.py index 3c1055c..46b374c 100644 --- a/common/conf_check.py +++ b/common/conf_check.py @@ -16,3 +16,13 @@ class ConfCheck: return pid_list[0] else: return '' + + def pid_list(process): + ''' + check process exist or not, return pid_list or null + ''' + get_pid_cmd = "ps -ef | grep {} | grep -v grep | awk '{{print $2}}'".format(process) + p_list = Command.cmd_run(get_pid_cmd).split("\n") + p_list.pop(0) + p_list.pop(-1) + return p_list -- Gitee