#! /Bin/shwebsite [0] = 'zufang .hfhouse.com/chuzu/' # Website 1 mobile [0] = '000000' # Website 1 mobile number website [1] = 'oldhouse .hfhouse.com/chushou/' # Same as 2 mobile [1] = '000000' # Same as above 2 # and so on, if there are too many websites, files can be performed, or the database read method is length =$ {# website [@]} # Get the total number of websites for (I = 0; I <$ length; I ++ )) # Do status =$ (curl-I-m 10-O/dev/null-S-w % {http_code }$ {website [$ I]}) # curl: Obtain the HTTP status code if ["$ status" X! = "200" X]; then # check whether it is 200 (normal) echo $ {website [$ I]} '=>' $ status # PHP/htdoc/JK/shell_monitor.php $ {Mobile [$ I] }$ {website [$ I]}' => accesserror! '# Execute the PHP file (PHP is mainly used to use a third-party SMS library, mail can also be sent here) Fi # End ifdone # end do
Run: crontab-e
Write content: 5 */Shell path
For more information about crontab parameters, see http://blog.csdn.net/tianlesoftware/article/details/5315039.