Skip to content Skip to sidebar Skip to footer

Check If Python Script Running From Another Python Script Linux

I have actualy python script running on background, you can see how it's displayed when i use command 'ps -aux' : root 405 0.0 2.6 34052 25328 ? S 09:52 0:04 p

Solution 1:

I resolve the issue with this modification :

import psutil

proc_iter = psutil.process_iter(attrs=["pid", "name", "cmdline"])
process = any("/opt/flask_server/downlink_server/downlink_manager.py" in p.info["cmdline"] for p in proc_iter)
print(process)

Post a Comment for "Check If Python Script Running From Another Python Script Linux"