proc = subprocess.Popen(["pgrep", "-f", __file__], stdout=subprocess.PIPE)
std = proc.communicate()
if len(std[0].decode().split()) > 1:
exit('Already running')
转载于:https://my.oschina.net/redhands/blog/3041830
proc = subprocess.Popen(["pgrep", "-f", __file__], stdout=subprocess.PIPE)
std = proc.communicate()
if len(std[0].decode().split()) > 1:
exit('Already running')
转载于:https://my.oschina.net/redhands/blog/3041830