Oe7.0在windows 上安装,经常会停掉服务!是什么问题?
-
我也有一个windows平台下的(apache+mod_python),供大家参考吧。
# -*- coding: utf-8 -*-<br /><br />import os, sys, time<br />from datetime import datetime<br />import requests, logging<br /><br />logging.captureWarnings(True)<br /><br />def _go():<br /> os.system("sc stop Apache2.4")<br /> os.system("sc start Apache2.4")<br /> time.sleep(5)<br /> print 'start Apache2 at %s' % datetime.now()<br /><br />print 'Apache2 monitor started...'<br /><br />while True:<br /> time.sleep(30)<br /> try:<br /> print 'pinging web server at %s.' % datetime.now()<br /> r = requests.get('https://xxxxxxxxxxx', verify=False, timeout=5) #place a real url here.<br /><br /> if r.status_code != requests.codes.ok:<br /> print 'server is dead at %s. restart it.'<br /> _go()<br /> else:<br /> print 'Nothing new. Go on.'<br /> except Exception, e:<br /> print 'Exception at %s, message is %s' % ( datetime.now(), e.message)<br /> print 'try to start Apache2.'<br /> _go()<br /><br />print 'Apache2 monitor ended...'