# -*- coding: utf-8 -*- # @Author: wangkun # @Time: 2023/5/23 import os import psutil class Demo: @classmethod def demo1(cls): # cmd = "ps aux | grep Appium.app" cmd = 'ps -ef | grep "run_gongzhonghao1_author_scheduling.py" | grep -v "grep"' result = os.popen(cmd).read() if len(result) == 0: print("yes") # for process in psutil.process_iter(): # # if "shipinhao" in process.name(): # print(f"{process.pid}, {process.name()}") if __name__ == "__main__": Demo.demo1()