1. 利用Shell脚本实现 #!/bin/bash PORT= while [ true ];do read -p "please enter the port that you want to minitor:" port ] || [ $port -lt ];then echo 'the port you enter is not correctly' else PORT=$port break fi done while [ true ]; do > /dev/ ] ;t…
近期花时间研究了一下windows和linux下某服务停了后自动重启的功能,在网上收集了些资料,并经过测试,在此整理一下.这里介绍的是windows服务的监控,是通过批处理来实现的.本例是监控windows的Computer Browser为例,每60秒检测一次(可根据实际需要调整间隔),当发现服务停止后自动重启.AutostartService.bat批处理文件内容如下 @echo off rem 定义循环间隔时间和监测的服务: set secs=60 set srvname="Compu…