网站down掉后,自动发信的shell

      脚本的目的是,当一个网站down掉后,自动给我发信
#!/bin/bash
#website test scripts
while true;do
        for cycle_temp in `cat websit_url_links`
        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"  [email protected] < /opt/test.txt
                fi
        done
        sleep 2s
done
 
websit_url_links的内容:

[url]http://www.bizcom.com.cn/test.jsp[/url]
[url]http://www.cisco-club.com.cn/test.jsp[/url]

你可能感兴趣的:(shell,网站,系统关闭,自动发信)