脚本的目的是,当一个网站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"  < /opt/test.txt
                fi
        done
        sleep 2s
done
 
websit_url_links的内容: