vb:
appPoolName = WScript.Arguments(0) Set oWebAdmin = GetObject("winmgmts:rootWebAdministration") Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='" + appPoolName + "'") oAppPool.Recycle set fso=createobject("scripting.filesystemobject") if (fso.fileexists("C:WebRootWebSiteFLFTaskLogs ecycleIISPool.log")) then '1-forreading,2-forwriting,8-appending set file=fso.opentextfile("C:WebRootWebSiteFLFTaskLogs ecycleIISPool.log",8,ture) else set file=fso.createtextfile( "C:WebRootWebSiteFLFTaskLogs ecycleIISPool.log",8,ture) end if 'write(x)写入x个字符,writeline写入换行,writeblanklines(n)写入N个空行 file.writeline now&" 应用程序池“"&appPoolName &"”已经回收成功。" file.close
并写bat
cscript recyclepool.vbs EduWebApi
并放入任务计划程序中 执行Bat
追加:
回收之后,但还是解决不了,回收第一次的请求卡,再追加一个Bat,调起url请求访问,借用curl实现:
@echo off color 1f echo 正在调起程序 echo.>>check.txt echo.正在调起程序 %date% >>check.txt echo 开始执行baidu.com %date% %time% >>check.txt curl -s http://www.baidu.com/api/Common/CheckProveStatus>>check.txt echo. 执行完成 %time% >>check.txt