mindau
4/27/2017 - 2:27 PM

Monitor website with linux

Monitor website with linux

#!/bin/sh
# script to check website status (online/ofline)

while read site
do
    if ping -w 60 -c1 -q "$site" &>/dev/null; then
        echo "$site is up" # for debug
    else
        # action to do if website offline
        echo "[$(date +%d-%m-%Y:%H:%M:%S)] $site is not reachable." | slackpost.sh
    fi
done < /path/to/file/sites.txt # list of sites to check