Skip to content

Instantly share code, notes, and snippets.

@R4wm
Created October 18, 2018 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save R4wm/d3ba9a2fa082fa9c32be3908a351dd39 to your computer and use it in GitHub Desktop.
Save R4wm/d3ba9a2fa082fa9c32be3908a351dd39 to your computer and use it in GitHub Desktop.
Simple way of finding process by name without using subprocess
#!/usr/bin/env python
import psutil
l_proc_list = psutil.get_process_list()
for i in l_proc_list:
if i.name == 'waflz_server':
print("FOUND WAFLZ_SERVER")
print(i.pid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment