Cron jobs allow you run a command or script on your site at user-defined time intervals.
To create a cron job in cPanel:
- Login to your cPanel account
- Go to Cron Jobs (ADVANCED Section)
- If you want to receive the output of the cron job then enter the email in the Email field and click the Update Email button
- Go to the Add New Cron Job section, select the Common Settings from the drop-down list. You can choose from the predefined values or you can enter your own values.
- Enter the command you wish to run. For example, to run a php file, use the command: home/username/public_html/test.php
- Click the Add New Cron Job button
- The new cron job will appear in the Current Cron Jobs Section
For the Common Settings you can choose from :
-Once Per Minute (* * * * *)
-Once Per Five Minutes (*/5 * * * *)
-Twice Per Hour (0,30 * * * *)
-Once Per Hour (0 * * * *)
-Twice Per Day (0 0,12 * * *)
-Once Per Day (0 0 * * *)
-Once Per Week (0 0 * * 0)
-On the 1st and 15th of the Month (0 0 1,15 * *)
-Once Per Month (0 0 1 * *)
-Once Per Year (0 0 1 1 *)
To delete a cron job in cPanel:
- Login to your cPanel account
- Go to Cron Jobs (ADVANCED Section)
- On the Current Cron Jobs Section, click the Delete link on the row with the cron job you want to delete.
- Click the Delete button when the cPanel is asking “Delete this cron job?“
- The cron job is deleted now.
To edit a cron job in cPanel:
- Login to your cPanel account
- Go to Cron Jobs (ADVANCED Section)
- On the Current Cron Jobs Section, click the Edit link on the row with the cron job you want to edit.
- Make the necessary changes. When done, click the Edit Line button.
Many web hosting providers will block your cron job if the running interval is too short. Ask your host what is the minimum value.
A cron job must include Minute, Hour, Day, Month, Weekday and Command fields.