In this tutorial, you will learn how to set up and manage Cron Jobs in cPanel. Cron jobs allow you to automate specific commands or scripts on your site.
You can set a command or script to run at a specific time every day, week, etc.
How to Setup and Manage Cron Jobs in cPanel #
1) Log into cPanel, scroll down to the Advanced section, then click the Cron Jobs icon
2) You can have cron(s) send an email every time it runs a command which produces output.
3) You must define exactly when and how often you want the cron job to run. This is made easier by using one of the pre-defined or common settings
Please note that by choosing one of the common settings, all fields will be filled in automatically.
This also helps you understand what each field means. For this example, we’ll choose the cron to run Once per day.
4) Next, enter the command of the script you want to run, including the path. You can find the most common binary paths here.
Remember to add a space between the binary and the path. In the example below, note the space between ‘php’ and ‘/home’.
/usr/bin/php /home/username/script.php
If you want to stop cron jobs email notifications, add the following code at the end of your cron job:
/dev/null 2>&1
5) When you’re done, click Add New Cron Job button.
That’s it! The cron job has been added with success. You can either create additional cron jobs, and edit or delete existing ones, under the Current Cron Jobs area.