Sometimes you need a simple log to know when a site is up or down.
Create a script like below and then put it in your crontab.
#!/bin/bash
echo 'Begin ping'
if ping -c 1 kittell.net &> /dev/null; then
echo "$(date "+%Y-%m-%d %H.%M.%S") - Success" >> /var/log/web_ping.log
else
echo "$(date "+%Y-%m-%d %H.%M.%S") - Error" >> /var/log/web_ping.log
fi
sudo crontab -e # Check every minute * * * * * /var/scripts/web_ping.sh
Originally Posted on January 29, 2024
Last Updated on August 17, 2024
Last Updated on August 17, 2024
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.