Pages

PHP Cron Jobs with cPanel

Cron jobs allow you to automate certain commands or scripts on your server to complete repetitive tasks automatically. A cron job allows you to run a certain command at times set by the job. For example, you could set a cron job to delete temporary files every week so that your disk space is not being used up by those files.

1. you can get started with the simple cron tool built into cPanel.url:

https://www.yoursite.com:2083/frontend/x/cron/simplecron.html?

To access the Cron Jobs Menu, click on the corresponding icon located on the main screen of your cPanel interface.


2. The cron email section of the Cron Jobs interface allows you to specify the email address where you would receive an email each time a cron job is ran for your account.

If you do not want an email to be sent for an individual cron job you can redirect the command's output to /dev/null like this:
mycommand >/dev/null 2>&1

You can enter the desired email address in the text box and click the Update Email button to apply the changes.


3. Next section of the Cron Job interface is where you actually set your cron jobs.
Once ready setting up the cron job click the "Add New Cron Job" button and it will be saved and activated for your account.


Want to select an option from all the select boxes. Remember to select an option in each box.

If you want something to run every day at 4AM:
select Minute: 0; Hour: 4; Day: Every; Month: Every; Weekday: Every;


4. The bottom part of the Cron Jobs interface will allow you to edit or delete existing cron jobs.

The command to run:
php -q /home/(username)/public_html/(scriptname).php