Saturday 11 August 2007

Check process

I use this simple python script to check bittorrent process and if it is not running it starts to vnc.


import os
def check_proc( *args ):
process = os.popen("ps -ef | grep bitt").read().splitlines()
if len(process) > 2:
print "process running"
else:
print "process not running"
os.system('su - user -c "export DISPLAY=127.0.0.1:2.0;bittorrent&"')"

check_proc()

No comments: