Creating Cron Jobs

You can create a cron job to do a certain task at specific times of the day. The 'job' could be maintenance to your website or any other unmanned server duties such as deleting temporary files to give more disk space. * * * The first step is to log into your cPanel account. If you are unsure on how to do this, please view the following help article - '[How to log into cPanel](https://hostpresto.com/help/article/1)'. ![alt text](https://i.imgur.com/QRmld56.png "Cron job 1") * * * Scroll down to the '**Advanced**' section and choose '**Cron Jobs**'. ![alt text](https://i.imgur.com/fMlcwXP.png "Cron job 2") * * * If you would like to receive an email each time your cron runs, you can do so by entering your email address in the '**Email**' section. You may find this useful to begin with to verify that your cron is running. ![alt text](https://i.imgur.com/obvlQ1B.png "Cron job 3") * * * Save the entered email adress by selecting '**Update Email**'. ![alt text](https://i.imgur.com/x4TJr2S.png "Cron job 4") * * * To setup the cron, in the '**Add New Cron Job**' section, you need to define when the cron needs to run and what command the cron is executing. Take advantage of the '**Common Settings**' for when the cron needs to run by opening the dropdown menu. If there's not one that suits your needs, enter the settings accordingly using the minute, hour, day, month and weekday options. ![alt text](https://i.imgur.com/lbT9NHA.png "Cron job 5") * * * Entering the cron command that needs to be executed is the most critical part. In our example, we want to run our cron.php file that has been placed in our public_html directory. To do this, we have written: ```php /home/hpdemo/public_html/cron.php``` Please note, you must set your account name in place of 'hpdemo'. ![alt text](https://i.imgur.com/rzR7SMW.png "Cron job 6") Once you are happy with your settings, select '**Add New Cron Job**'. If you require multiple crons to be executed, please follow this article again inserting the alternative command(s). Creating a cron for your website is now complete. * * *
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to log into cPanel

There are two different methods to log into your cPanel control panel in order to manage every...

What's the difference between Aliases, Addon and Subdomains?

### Aliases An Alias domain does not have a unique website. It is a domain that is masked to...

Creating a MySql Database

If your website uses PHP or you need to hold a collection of records which need to be accessed...

Importing a MySql Database

You can import a MySQL database via phpMyAdmin which is available in the cPanel control panel....

Exporting a MySql Database

You can export a MySQL database via phpMyAdmin, available in cPanel, if you want to keep a backup...