wamp 服务监控和启动
2024-08-26 07:17:55
近日我的 wamp 莫名其妙的崩溃重启,apache 能自动起来, mysql 却悲剧了。
于是有了下面的wamp服务监控和启动的批处理文件
@echo off rem define loop time
set secs=5
set srvname1="wampapache64"
set srvname2="wampmysqld64" echo.
echo ==========================================================
echo == Query Services Status Every %secs% second
echo == Auto Start Services : %srvname1%, %srvname2%
echo ==========================================================
echo Detecting ...
if %srvname1%. == . goto end
if %srvname2%. == . goto end :chkit
set svrst1=0
for /F "tokens=1* delims= " %%a in ('net start') do if /I "%%a" == %srvname1% set svrst1=1
if %svrst1% == 0 echo %date%-%time%
if %svrst1% == 0 net start %srvname1%
set svrst1= ping -n %secs% 127.0.0.1 > nul set svrst2=0
for /F "tokens=1* delims= " %%a in ('net start') do if /I "%%a" == %srvname2% set svrst2=1
if %svrst2% == 0 echo %date%-%time%
if %svrst2% == 0 net start %srvname2% set svrst2= ping -n %secs% 127.0.0.1 > nul goto chkit :end
关键的命令是 for /F "tokens=1* delims= " %%a in ('net start') do if /I "%%a" == %srvname1% set svrst1=1
详细的 For 命令解说,可参考 : dos下 和 批处理中的 for 语句的基本用法
最新文章
- poj 2187 Beauty Contest(凸包求解多节点的之间的最大距离)
- Log4j、slf4j
- Sprint第一个冲刺(第十一天)
- c++ 读取并解析excel文件方法
- windows下安装redis和php的redis扩展
- [RxJS] Creation operator: of()
- MYSQL查询男女数量的存储过程
- if与while相互嵌套,菱形*的实现.py
- 【Android 应用开发】Android 网络编程 API笔记 - java.net 包相关 接口 api
- 关于pandas 调用mongodb出Memory error错误
- saltstack常用命令
- Ubuntu1404 开启定时任务 crontab
- linux按键映射
- 解析Resources.arsc
- 【SPL标准库专题(6)】 Datastructures:SplPriorityQueue
- ASP.NET MVC 中使用Ckeditor4.5 编辑器
- VLOG丨树莓派Raspberry Pi 3安装PLEX并挂载USB硬盘打造最牛的微型家庭影音服务器2018
- Q_OBJECT宏的作用
- PL/SQL轻量版(一)——入门介绍
- 游戏引擎架构Note2
热门文章
- reactor线程阻塞引起故障
- git提交代码到github
- javascript之事件模型
- div效果很好的遮盖层效果
- MySQL最佳实践
- Java 8新特性探究(五)Base64详解
- ROS_Kinetic_05 ROS基础内容(二)
- Chapter 2 User Authentication, Authorization, and Security(1):选择Windows和SQL 身份验证
- int(*p)[]和int(**p)[]
- Leetcode_70_Climbing Stairs