< All Topics

In this tutorial, you will learn how to setup a cron job in the cPanel dashboard, available to users on one of Hosted.com’s cPanel Web Hosting plans.

Automating repetitive processes using cron jobs is a great way to streamline server maintenance and ensure smooth application deployment. Cron jobs offer the option to plan instructions or scripts for daily, weekly, or monthly execution at predetermined intervals.

As an example, a weekly cron task can be used to set up to remove temporary files automatically to optimize system speed and disk space use. This automation frees up time and resources for other important tasks and improves operational efficiency.

How To Setup A Cron Job In cPanel

This tutorial assumes you have cPanel and have logged in.

Warning: You need to have a good knowledge of Linux commands to use cron jobs effectively. Check your script with your hosting administrator before you add a cron job.

Now, let’s show you how to set up a cron job.

1. Click “Cron Jobs” under the Advanced section of the cPanel Dashboard.

2. Enter the Email Address you want the cron job results sent to each time it runs.

Setup A Cron Job In cPanel - cPanel Cron Panel

3. Now you must set the criteria that define exactly when and how often you want the cron job to run. This is simplified by using one of the pre-defined or “Common Settings”.

Notice that by choosing a “Common Setting”, all fields are filled in automatically. This also helps you understand what each field means.

4. For this tutorial, we chose “Once Per Week”.

5. Next, enter the Command of the Script you want to run, including the Path (from root).

6. When ready, click “Add New Cron Job”.

Setup A Cron Job In cPanel - Add New Cron Job

That’s it! The cron job has been set.

Setup A Cron Job In cPanel - Cron Settings

Ynder the “Current Cron Jobs” list you can create additional cron jobs and edit or delete existing ones under the “Actions” menu.

This is the end of the tutorial. Now you know how to set up cron jobs in cPanel!

Additional Information:

Benefits Of Cron Jobs

For various operations that you need to perform automatically and regularly on your server, setting up a cron job might be helpful. Here are cases where cron jobs are often used:

Scheduled Backups

You can configure a cron job to automatically backup your website files and databases regularly. This ensures you always have recent backups available in case of data loss or server problems.

Automated Maintenance Tasks

These jobs can be used for regular maintenance procedures including software package updates, database optimization, and cache file clearing.

Email Reports

If you need to generate and send reports via email regularly, you can set up a cron job to execute a script that creates and sends reports automatically.

Data Synchronization

Use cron tasks to synchronize data between several databases or systems now and then.

Content Updates

If websites or applications need content updates regularly, you can use cron jobs to retrieve fresh content from outside sources and update your website or database.

Monitoring & Alerts

You can set up cron jobs to execute scripts that watch server performance indicators or look for specific conditions. If certain thresholds are surpassed, these scripts will send out alerts or notifications.

Automated Testing

Cron tasks can be used in software development to schedule automatic tests to execute at predetermined periods; they help ensure the dependability and functionality of your applications.

Was this article helpful?
Please Share Your Feedback
How Can We Improve This Article?