Home > Help Center > Shared Hosting > Control Panel > Create and Manage Cron Jobs in CPanel

Create and Manage Cron Jobs in CPanel

Cron jobs are scheduled tasks that the system runs from a script file at predefined times or intervals.

Cron Jobs allow you to automate certain commands or scripts on your server to complete repetitive tasks automatically such as deleting temporary files, generating logs, sending periodic sales reports or stock availability, etc. Setting up too many cron jobs to run too often will surely overload any server and will degrade its performance.

In order to ensure servers' performance, especially on shared hosting, usually a minimum time interval is set to run the repetitive cron jobs - on HostPulse servers this interval is 30 minutes.

Before setting up the cronjob, open in a browser the file you wish the cronjob to run to make sure it works correctly.

Proper cron jobs setup is a complex task and requires a good understanding of PHP or other scripting languages. If you have never set up cron jobs before, and you feel even a bit insecure, please consult with the technical support.

Go to cPanel > Advanced and click on Cron Jobs link:

Cron Jobs link in cPanel

Add a cron email

To set an email address for the system to send notifications when your cron jobs run, enter the email address at which you wish to receive the notifications in the Email text field and click Update Email button:

Set an email to receive notifications

Add a cron job

To create a cron job, perform the following steps:

Select the interval at which you wish to run the cron job from the appropriate menus, or enter the values in the text boxes.

Common Settings — this menu allows you to select a commonly-used interval.

The system will configure the appropriate settings in the Minute, Hour, Day, Month, and Weekday text boxes for you:

Preconfigured general interval settings

  • Minute - select the number of minutes between each time the cron job runs, or the minute of each hour on which you wish to run the cron job.
  • Hour - select the number of hours between each time the cron job runs, or the hour of each day on which you wish to run the cron job.
  • Day - select the number of days between each time the cron job runs, or the day of the month on which you wish to run the cron job.
  • Month - select the number of months between each time the cron job runs, or the month of the year in which you wish to run the cron job.
  • Weekday - select the days of the week on which you wish to run the cron job.

Additional interval settings

In the Command text field, enter the command that you wish the system to run:

Command text field

Specify the PHP version to run the file and the absolute path to the command, that you wish to run (there must be a space between the two strings):

php56 /home/cpaneluser/public_html/hostpulse-addon.com/mymail.php

If you want to disable notifications for a specific cron job, add the following line to the command:

>/dev/null 2>&1

Warning: Be very careful when you use the rm command in a cron job. If you do not declare the correct options, you may delete your home directory's data.

Click the Add New Cron Job button.

The new cron job will appear in the Current Cron Jobs table below:

Table Current Cron Jobs

Edit a cron job

In the Current Cron Jobs table find the cron job that you wish to edit and click Edit:

Edit a cron job

Edit the settings that you wish to change and click the Edit Line button.

Delete a cron job

Click Delete next to the cron job that you wish to delete:

Delete a cron job

Click the Delete button.

Conclusion

Cron jobs is a very useful tool but must be managed with extreme caution. If you have any questions our support team will be happy to help you.

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support