#!/usr/bin/env python
import os
import urllib,urllib2
import time
def autohalt():
ps_string = os.popen("ps ax | grep -i 'mytest.py' | grep -v grep | awk '{print $1}'").read()
#print(ps_string)
ps_split = ps_string.strip().split('/n')
if(len(ps_split)>0):
print('still running')
else:
send_url('13810592328')
def checkphp():
php_string = os.popen("ps ax | grep -i 'phppost' | grep -v grep | awk '{print $1}'").read()
php_split = php_string.strip().split('/n')
if(len(php_split)>0):
print('still running')
else:
send_url('13810592328')
def send_url(number):
print(number)
#url="curl http://10.0.0.27:82/sms_shouji.php?mobile="+number+"&content="+msg
#req = urllib2.Request(url)
#print req
#res_data = urllib2.urlopen(req)
#res = res_data.read()
#print res
os.popen("curl \"http://10.0.0.27:82/sms_shouji.php?mobile="+number+"&content=python-eroor\"")
print('send')
if __name__ =='__main__':
autohalt()
checkphp()