设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 操作系统 >> 经验技巧 >> Windows下使用批处理实现对网站的监测
精品推荐
经验技巧点击TOP10
·制作Windows XP和Vista双系统启动菜单
·网吧操作系统制作与优化2007最终版
·FAT32转换NTFS的方法
·解决系统提示"你是软件盗版的受害者"
·如何双启动Windows XP和Windows Vista
·解读多重启动引导文件——BOOT.INI
·微软操作系统进程详解
·Windows 2000,Windows XP,Windows 2003 系统重新封装参考资料
·批处理命令 xp服务优化
·快速重装Windows操作系统的众多要点
操作系统点击TOP10
·Windows Vista完全硬盘安装法
·Windows Vista 激活不求人
·Windows Vista局域网网络连接设置
·Windows Vista系统动态桌面截图欣赏
·Windows XP中磁盘的分区应用
·Windows NT/2000/XP 出现蓝屏并显示“STOP 0x0000007f”错误
·让Windows XP变身Vista
·一招搞定Vista系统软件不兼容问题
·教你如何正确配置和优化Windows Vista
·只转两圈 加快Windows XP启动速度
精选专题

Windows下使用批处理实现对网站的监测

作者: 来源: 时间:2006-9-6 14:05:43

Windows下使用批处理实现对网站的监测(1)

由于多数监测软件是商业性质,同时使用过一个付费的监测服务感觉效果并不理想,于是动手弄了一个自己的监测系统,使用DOS批处理操作。

原理:
    使用了一个Wget.exe 的Win32版本用以从网站下载文件,利用批处理命令检测文件是否抓取成功,如果成功,删除已经下载的文件,退出批处理,如果不成功,利用安装在电脑上的modem拨打某个电话号码,使用特定的振铃次数通知网站发生故障。

    测试后将批处理放到windows中的计划任务中周期执行。

注意:wget.exe需要放置到与批处理相同的目录,或者放入windows系统目录。

批处理文件:

monitor.bat
@echo off
echo.>>wget.log
rem 使用wget下载网页首页文件,并记录日志
.\wget -a wget.log -d http://www.xxx.com   
rem 判断index.html文件是否下载成功
if exist index.html goto end
echo.>>system.log
echo ---------------------------->>system.log
date/t>>system.log&&time/t>>system.log
echo error occurred>>system.log
rem 调用一个拨号批处理
call .\dial.bat
exit

:end
echo.>>system.log
echo ---------------------------->>system.log
date/t>>system.log&&time/t>>system.log
echo ok>>system.log
echo ydel .\index.html
exit

dial.bat
@echo off
rem 使用at指令传送到串口拨号
echo atdtxxxxxxx >com1
rem 延时14秒,振铃3次
choice /c yn /d y /n /t 14 >nul
rem 挂机
echo ath>com1
choice /c yn /d y /n /t 5 >nul
echo atdtxxxxxxx >com1
choice /c yn /d y /n /t 14 >nul
echo ath>com1
choice /c yn /d y /n /t 5 >nul
echo atdtxxxxxxx >com1
choice /c yn /d y /n /t 14 >nul
echo ath>com1

(完)

批处理文件:

monitor.bat
@echo off
echo.>>wget.log
rem 使用wget下载网页首页文件,并记录日志
.\wget -a wget.log -d http://www.xxx.com   
rem 判断index.html文件是否下载成功
if exist index.html goto end
echo.>>system.log
echo ---------------------------->>system.log
date/t>>system.log&&time/t>>system.log

共2页 9 7 [1] [28 :>

Windows下使用批处理实现对网站的监测 相关文章:
Windows下使用批处理实现对网站的监测 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com