The last example is a modified version of the previous example. When mail is not configured on the system the script will create a log file. The core of the script is wrapped into endless while loop which is set to execute ping check every hour ( 3600 second ). Modify the script according to your needs. Remove endless while loop when you intend to use this script with cron scheduler.