Some web hosting tasks can be tedious, not because they are difficult, but because you have to repeat them daily, monthly, or even hourly in some cases. Repetitive tasks, such as backups, are very important and forgetting to performing them can sometimes be dangerous. Fortunately, Linux and Unix servers have a task automation system called Crond, and with cPanel, you can configure Cron jobs in a graphical environment.
To create Cron jobs in cPanel, just follow these steps:
- Login to cPanel and click “Cron Jobs” in the Advanced section at the bottom
- Enter an email address in the first line only if you want Cron to send you emails after each job has been completed. If you do not want to receive emails, leave the default choice and send emails to /dev/null for deletion in the command settings below.
- In the next section, you can select one of the timing presets, such as every 15 minutes, twice a day, or once a month. Alternatively, you can set your own specific time, specifying the time of day, day of the week, days of the month, and/or months of the year.
- In the final box, you will need to enter the full path to your script or command. For example, if you are trying to run a PHP e-commerce batch processing script, your path might look like this: /home/user/www/html/myscript/myscript.php
If you are running a regular Linux or Unix command, the path may be like this: /usr/bin/command
Finally, if you want to delete emails rather than receive them after each job, make the command string look like this:
mycommand >/dev/null 2>&1
For more information about cron jobs in cPanel, you can read the full documentation online.