cPanel Cron Job Tips
Posted by Jamison on 14 10 2015.
Cron jobs are some of the most important and useful aspects of cPanel. Basically, these are tasks scheduled to run at set intervals and times. In most cases, a single cron job can already perform several simple tasks through the use a script file that the system is responsible for executing.
To get the most out of your cron jobs, here are some of the most useful tasks you can set them to run.
The Cron Email is the cPanel section that allows you to put in an email address you want to send notifications to once the cron jobs are executed.
To specify the email address, here are the steps you need to perform:
- Look for the “Email” text box, and put in the email address you want your system to send the notifications to.
- Hit the “Update Email” option.
Adding Cron Jobs
When you want to create a cron job, make sure you do the following:
- Choose your preferred interval at which the cron job should be run at. You can pick from the menus given, or enter a custom value in the text box.
- The command that you want the system to execute when running the cron job should be entered in the text box titled “Command.”
- Hit the “Add New Cron Job” button.
Important Notes When Adding Cron Jobs
Every time that you create a new cron job, you should make sure that:
- You indicate the command’s absolute path, in order for it to work properly. For instance, in the event that the cron job you are going to create is set to execute the “public_html/index.php” file located in your cPanel’s home directory, this command should be specified:
- You specify how often or frequent you want the cron job to be executed. You can do this by checking any of the boxes for the “Minute,” “Hour,” “Day,” “Month,” “Weekday,” and “Command.”
- You see a green check mark beside the settings that you have selected. If not, the system is not going to apply the selection you made.
- You keep a lookout for a red warning icon. If you see this, it means that you have entered something incorrectly, or that the setting you have selected is invalid.
- You are very careful whenever excuting the “rm” command for cron jobs. The primary reason for this is due to the possibility of deleting your home directory’s data. This can happen if you do not set the correct options when creating cron jobs.
Checking Existing Cron Jobs
If you want to view the cron jobs you have already created in the past, you can do so by heading to the “Current Cron Jobs” option.
Revising an Existing Cron Job
When you need to edit an existing cron job, you just need to do these two steps:
- Find the cron job for revision in the “Current Cron Jobs” list. Hit the “Edit” button.
- Perform the revisions and then click the “Edit Line” option.
Deleting/Removing an Existing Cron Job
When you want to get rid of an existing cron job, you just have to:
- Locate the cron job you want to remove and then click on the “Delete” option beside it.
- Hit “Delete.”
Cron jobs, despite running just simple tasks, are very handy, so make sure you make the most out of them.