windows apache 服务 监控重启脚本
2016-01-20 18:49
603 查看
工作中遇到 windows下apache 运行几天后总是会没响应的问题,写了下面的脚本来监控apache 服务实例的运行状态,检测到服务器无响应则重启。
工作原理:
1. 脚本定时通过curl 获取网站指定的页面,如果获取失败则重启监控的 apache 实例;
2. 把脚本放到windows计划任务里定时执行就行了;
curl 可通过 curl 官网下载,我也打了个包放在了 csdn上:
apacheMonitor
工作原理:
1. 脚本定时通过curl 获取网站指定的页面,如果获取失败则重启监控的 apache 实例;
2. 把脚本放到windows计划任务里定时执行就行了;
curl 可通过 curl 官网下载,我也打了个包放在了 csdn上:
apacheMonitor
@echo off set chkWeb=http://192.168.2.31 set apacheInsName=apache2.2 curl -o home.html %chkWeb% if %errorlevel% EQU 0 goto :success if %errorlevel% NEQ 0 goto :errH :success echo 'Server is OK' >> out.txt goto :eof :errH echo %date% %time%: error Code:%errorlevel% >> out.txt net stop %apacheInsName% ping /n 5 127.1 >nul net start %apacheInsName% if %errorlevel% EQU 0 goto :restartSuccess if %errorlevel% NEQ goto :errH goto :eof :restartSuccess echo %date% %time%: Server restart Success >> out.txt goto :eof :eof
相关文章推荐
- Apache shiro 文章推荐
- 一次apache出现403错误排查
- Windows2003 Apache 关闭安全 开启错误输入到屏幕上
- apache mina 与 SEDA
- apache域名重定向301跳转 .htaccess的写法
- java.lang.Throwable: Child Error at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:271) Ca
- apache commons-io 用户手册
- apache mina:SimpleIoProcessorPool
- apache无法启动解决办法
- apache mina: IoFilterChain 过滤链
- org.apache.cxf.interceptor.Fault: Unmarshalling Error:
- 【手把手教你全文检索】Apache Lucene初探
- Linux---CentOS下编译安装Apache后只显示测试页面解决方法
- 手动将Apache注册为系统服务
- org.apache.commons.lang3.time之DateUtil
- PHP+Apache配置备忘
- 【Apache运维基础(4)】Apache的Rewrite攻略(1)
- apache2.4.18中启用h2c
- apache多站点配置
- Mac下PHP+MySQL+Apache2环境搭建