How to setup a cronjob in cPanel

How to setup a cronjob in cPanel

Setting up a cron job in cPanel allows you to schedule automated tasks to run at specific intervals. When creating a job, you should have some basic knowledge of CLI commands as this is what is used to setup a command.

The cPanel Interface makes it very easy for users to setup their schedule and provides more flexibility.


Here’s a step-by-step guide on how to set up a cron job in cPanel:


Log in to cPanel:

Log in to your cPanel account using your username and password. This information is typically provided by your hosting provider.

Image link

Locate the Cron Jobs Icon:

Inside your cPanel dashboard, you’ll find an icon labeled “Cron Jobs.” Click on it to access the cron job management interface

Image link

Choose a Cron Email:

When you create a cron job, the system can send an email with the output of the command to an address of your choice. You can set this email by filling in the “Email” field. Alternatively, you can leave it blank to receive no emails.

Select the Appropriate Time Interval:

cPanel provides a user-friendly interface for setting up the time intervals for your cron job. You can choose from a variety of common intervals, such as “Once per minute,” “Hourly,” “Daily,” etc. Select the interval that suits your needs.


Define the Command:

In the “Command” field, you’ll need to specify the actual command or script that you want the cron job to run. For example, if you want to run a script located in your home directory, you can use a command like:


/usr/bin/php /home/username/public_html/script.php


Replace `/usr/bin/php` with the appropriate command, and adjust the path to your script and file location.

Image link

Add the Cron Job:

After specifying the time interval and the command, click the “Add New Cron Job” or “Add Cron Job” button to save and schedule the cron job.


Review and Edit Cron Jobs:

Once added, you’ll see a list of your cron jobs, and you can review and edit them if needed. You can also delete or disable cron jobs from this interface.


That’s it! You’ve successfully set up a cron job in cPanel. The system will automatically run the specified command or script at the intervals you defined. Make sure your command is correct and that it won’t cause any issues on your server. Always test your cron jobs to ensure they work as expected.

Related Posts