# -*- coding: utf-8 -*-
import webbrowser,os,time
base_path = 'F:\webapps' #重启日志信息文件的路径
log_file = base_path + '\%s.log' %(time.strftime('%Y%m%d',time.localtime()))
now = int(time.time())
timeArray = time.localtime(now)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
def chongqi():
try:
detection = len(os.popen('tasklist /FI "IMAGENAME eq iexplore.exe"').read().decode('cp936'))
if detection > 19: #检测ie进程是否存在,存在则杀掉,不存在则直接打开html文件
os.system('taskkill /F /IM iexplore.exe') #把ie浏览器杀掉
webbrowser.open_new('F:\\webapps\\haha\\iexplore1.lnk')
webbrowser.open_new('F:\\webapps\\haha\\iexplore2.lnk') #重启每个html文件,这里将html文件都做成快捷方式更方便
webbrowser.open_new('F:\\webapps\\haha\\iexplore3.lnk')
webbrowser.open_new('F:\\webapps\\haha\\iexplore4.lnk')
os.system("echo %s browser restart,url open succesfully! >> %s" %(otherStyleTime, log_file))
else:
webbrowser.open_new('C:\inetpub\wwwroot\iexplore1.lnk')
webbrowser.open_new('C:\inetpub\wwwroot\iexplore2.lnk')
webbrowser.open_new('C:\inetpub\wwwroot\iexplore3.lnk')
webbrowser.open_new('C:\inetpub\wwwroot\iexplore4.lnk')
os.system("echo %s browser do not restart,url open successfully! >> %s" %(otherStyleTime, log_file))
except:
os.system("echo %s restart url failed! >> %s" %(otherStyleTime, log_file))
if __name__ == '__main__':
chongqi()
import webbrowser,os,time
base_path = 'F:\webapps' #重启日志信息文件的路径
log_file = base_path + '\%s.log' %(time.strftime('%Y%m%d',time.localtime()))
now = int(time.time())
timeArray = time.localtime(now)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
def chongqi():
try:
detection = len(os.popen('tasklist /FI "IMAGENAME eq iexplore.exe"').read().decode('cp936'))
if detection > 19: #检测ie进程是否存在,存在则杀掉,不存在则直接打开html文件
os.system('taskkill /F /IM iexplore.exe') #把ie浏览器杀掉
webbrowser.open_new('F:\\webapps\\haha\\iexplore1.lnk')
webbrowser.open_new('F:\\webapps\\haha\\iexplore2.lnk') #重启每个html文件,这里将html文件都做成快捷方式更方便
webbrowser.open_new('F:\\webapps\\haha\\iexplore3.lnk')
webbrowser.open_new('F:\\webapps\\haha\\iexplore4.lnk')
os.system("echo %s browser restart,url open succesfully! >> %s" %(otherStyleTime, log_file))
else:
webbrowser.open_new('C:\inetpub\wwwroot\iexplore1.lnk')
webbrowser.open_new('C:\inetpub\wwwroot\iexplore2.lnk')
webbrowser.open_new('C:\inetpub\wwwroot\iexplore3.lnk')
webbrowser.open_new('C:\inetpub\wwwroot\iexplore4.lnk')
os.system("echo %s browser do not restart,url open successfully! >> %s" %(otherStyleTime, log_file))
except:
os.system("echo %s restart url failed! >> %s" %(otherStyleTime, log_file))
if __name__ == '__main__':
chongqi()