`
hsyd
  • 浏览: 173407 次
  • 性别: Icon_minigender_1
  • 来自: 淄博
社区版块
存档分类
最新评论

tomcat 自动重启

阅读更多
下面是一段vbs脚本,把它保存成文件(后缀名为vbs)后双击运行就行了  
    当tomcat内存溢出时自动重启:
  on   error   resume   Next     
    
  Dim   a     
  a   =   True     
    
  set   WshShell   =   WScript.CreateObject("WScript.Shell")     
    
  Do   While   a     
  set   http   =   CreateObject("Microsoft.XMLHTTP")     
  http.open   "POST","http://www.163.com(这里放你网站的页面地址)",false     
  http.send     
  if   http.Status   >   300   then     
  WshShell.Run("net   stop   tomcat6")     
  WScript.Sleep(10000)     
  WshShell.Run("net   start   tomcat6")     
  end   if     
  WScript.Sleep(30000)     
  loop



每隔3天自动重启:
on   error   resume   Next     
    
  Dim   a     
  a   =   True     
    
  set   WshShell   =   WScript.CreateObject("WScript.Shell")     
    
  Do   While   a     
    
  WshShell.Run("net   stop   tomcat6")     
  WScript.Sleep(10000)     
  WshShell.Run("net   start   tomcat6")     
  WScript.Sleep(1000*60*60*24*3)     
  loop   


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics