首页 > 系统 > Linux > 正文

检测网站down掉后自动发信的shell脚本代码

2019-10-26 18:36:11
字体:
来源:转载
供稿:网友
代码如下:
#!/bin/bash
#website test scripts
while true;do
        for cycle_temp in `cat url_list`
        do
                if  lynx -dump `echo ${cycle_temp}` -accept_all_cookies|grep "true";then
                        echo "The website is running naturally"

                else
                        echo "${cycle_temp} has been offline please attend it now!">/opt/test.txt
                        mail -v -s "website down mail" reterry123@163.com < /opt/test.txt
                fi
        done
        sleep 2s
done
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表