How to create and manage Cron jobs in Site Tools?
Table of Contents
Common use of cron jobs
Cron jobs are mainly used to perform repetitive tasks at a specific schedule, such as:
- regularly cleaning up unnecessary files from the account;
- sending periodic messages such as newsletters;
- flushing the cache of the website application to ensure that a website shows up-to-date content;
- performing regular maintenance checks;
- reindexing and refreshing product and client information.
What can I automate with cron jobs?
With cron jobs you can automate actions you do regularly such as:
- cache purging;
- removing old files;
- deleting temporary files;
- executing PHP scripts, etc.
How to create and manage Cron jobs – Video Guide
How to Add a New Cron Job?
To add a new cron job in Site Tools, go to Devs > Cron Jobs. Enter the time interval for the cron execution, the exact command, and click Create.
How to Delete a Cron Job?
To delete a cron job in Site Tools, go to Devs > Cron Jobs. Find the corresponding cron in the Manage Cron Jobs section and click on the Delete (trashcan) icon next to it.
How to modify an existing Cron Job?
In case you need to modify the parameters of an existing cron job, go to Site Tools > Devs > Cron Jobs. Under Manage Cron Jobs, press the Edit button next to the Cron Job you wish to modify.
How can I check if the scheduled cron jobs are properly executed?
SiteGround monitors closely all operations on the servers and makes sure that all user cron jobs are being run on time.
If you’d still like to check your cron jobs, provide a valid email account when setting the Cron Jobs in Site Tools.
When you specify a valid email, you will receive the output of the cron job that is executed. Thus, you will be able to check it and make sure everything has been executed correctly. Note that you will not receive an email if there is no output from the cron job command.
Bear in mind that you will receive an email for each of the executed cron jobs. This may flood your inbox in case your crons run too often.
How do I stop cron jobs email notifications?
Add the following code at the end of your cron job to stop email notifications:
> /dev/null 2>&1