網站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的內容:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章