How to Setup a CRON Job in cPanel Tha will Check Every 30 Minutes to Ensure Your Website Is Active. And If It’s no, send you an email to let you know.
Here’s an example CRON job script that you can use in your cPanel hosting to check your websites’ availability every 30 minutes and notify you via email if one, or any of your sites are offline:
- Log in to your cPanel account.
- Go to the “Cron Jobs” section and click on “Create a Cron Job”.
- In the “Common Settings” dropdown menu, select “Every 30 minutes”.
- In the “Command” field, paste the following script:
wget -q –spider https://your-website-url.com || echo “Website is down: https://your-website-url.com” | mail -s “Website down” your-email-address@example.com
Obviousely you need to replace https://your-website-url.com with the URL of the website you want to monitor. And replace your-email-address@example.com with your email address where you want to receive notifications.
Click on “Add New Cron Job” to save the changes.
This script uses the wget command to check if your website is accessible, and if it’s not, it sends an email notification to your specified email address.
You can repeat steps 2 onwards to add more cron jobs for your other websites.
Now you can relax,
PS. This script was written in March or 2023 so if you are viewing this a year or two after this was published, please check with your hosting provider whether this process is still good to use.
Your hosting & cpanel account are your responsibility and this information is here to help but should not be used without prior testing to ensure compatibility with your setup.
You stuff is your responsibility.