demo.py 560 B

1234567891011121314151617181920212223
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2023/5/23
  4. import os
  5. import psutil
  6. class Demo:
  7. @classmethod
  8. def demo1(cls):
  9. # cmd = "ps aux | grep Appium.app"
  10. cmd = 'ps -ef | grep "run_gongzhonghao1_author_scheduling.py" | grep -v "grep"'
  11. result = os.popen(cmd).read()
  12. if len(result) == 0:
  13. print("yes")
  14. # for process in psutil.process_iter():
  15. # # if "shipinhao" in process.name():
  16. # print(f"{process.pid}, {process.name()}")
  17. if __name__ == "__main__":
  18. Demo.demo1()