您的位置:首页 > 运维架构 > Shell

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

2018-10-12 13:51 351 查看

#!/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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: