关于windows server 2003 ISA ttl值为1解决方案

公司的ISA服务器,最近一段时间出现问题。经常出现ISA映射的网站及服务器无法访问,PING值为1,内部服务器无法上网,网络异常等。开始可以通过重启服务器来解决问题,后来情况严重,经过详细检查,发现是由于ISA服务器上的路由及远程访问服务停止,无法启动导致的,检查系统服务,自动启动正常,因为软件冲突导致无法正常启动。

解决方法:

写启动脚本,自动启动及时段自动检查

      原始脚本如下:

@echo off
if not exist e:\startlog (mkdir e:\startlog)
CD /D "e:\startlog"
SET /A size=1*1024*1024
FOR /F "delims=" %%I IN ('DIR /A:-D /B') DO IF %%~zI GTR %size% (DEL /A /F "%%~I")
sc query |find /i "routing and remote access" >nul 2>nul
if not errorlevel 1 (goto exist) else goto notexist
:exist
@echo routing and remote access already starting >>e:\startlog\starting.log
@echo %date% %time% >> e:\startlog\starting.log
goto :eof
:notexist
@echo routing and remote access stoping,I will starting it >>e:\startlog\stoping.log
@echo %date% %time% >> e:\startlog\stoping.log
@net start "routing and remote access"
goto :eof

      脚本改进:

@echo off
rem 在此输入路径
set logpathdir=e:\startlog
rem 日志保存目录
set logpathstart="%logpathdir%\starting.log"
rem 服务如果已经启动,记录保存文件
set logpathstop="%logpathdir%\stoping.log"
rem 服务如果关闭,则启动服务保存文件
set /A logsize=1*1024*1024
rem 设置日志文件的上限
if not exist %logpathdir% (mkdir %logpathdir%)
rem 如果日志保存目录不存在 则创建
cd /d %logpathdir%
for /f "delims=" %%I IN ('dir /A:-D /B *.log') do if %%~zI GTR %logsize% (del /a /f /q "%%~I")
rem 如果日志文件超过上限 则删除
sc query |find /i "routing and remote access" >nul 2>nul
rem 判断服务是否在运行
if not errorlevel 1 (goto exist) else goto notexist
rem 判断结果在运行 则进入exist 如果没有运行则进入notexist
:exist
@echo routing and remote access already starting >>%logpathstart%
@echo %date% %time% >> %logpathstart%
goto :eof
:notexist
@echo routing and remote access stoping,I will starting it >>%logpathstop%
@echo %date% %time% >> %logpathstop%
@net start "routing and remote access"
goto :eof

二〇一四年五月十二日 13:36:36

点赞