If you’re hosting your website with Hostingest, setting up cron jobs is an efficient way to automate tasks and keep your site running smoothly. Cron jobs are scheduled tasks that run commands or scripts at specified intervals. In this guide, we’ll walk you through everything you need to know about setting up cron jobs in cPanel.
What Are Cron Jobs and Why Are They Important?
Cron jobs allow you to automate repetitive tasks like running scripts, clearing cache, sending email notifications, or performing backups. They help save time and ensure your website operates efficiently without manual intervention.
How to Access Cron Jobs in cPanel
- Log in to your cPanel account through Hostingest.
- Under the Advanced section, click on Cron Jobs.
- You’ll see options to set the timing for your cron job and an input box to add your command.

Step-by-Step Guide to Setting Up Cron Jobs
Choose Timing
Decide how often you want the cron job to run. You can select predefined intervals (e.g., once per hour, daily) or customize the schedule using the Minute, Hour, Day, Month, and Weekday fields.

For Advanced Users – Enter Your Command
Enter the command to execute your task. The typical format looks like this:
/path/to/program /home/yourusername/path_to_script > /dev/null 2>&1
Example for PHP Scripts
If you’re running a PHP script, your command might look like this:
/etc/cl.selector/php /home/yourusername/script.php > /dev/null 2>&1
To specify a particular PHP version, use:
/opt/alt/php73/usr/bin/php /home/yourusername/script.php > /dev/null 2>&1
Replace 73
with the version you want, such as 74
for PHP 7.4 or 80
for PHP 8.0.
Running Cron Jobs with URLs
If your cron job requires executing a URL (e.g., a system that triggers tasks via webhooks), you can’t just enter the URL directly. Instead, use wget
, which instructs the server to visit the URL like a browser.
Here’s the command format:
wget -O /dev/null -o /dev/null "https://yourwebsite.com/command"
Replace https://yourwebsite.com/command
with your actual URL. Make sure to enclose the URL in quotation marks for proper execution.
Managing Cron Job Output
Silence Output
By default, cron jobs may send output to your server’s email inbox, which can clutter your mailbox. To suppress output, include this at the end of your command:
> /dev/null 2>&1
For example:
/etc/cl.selector/php /home/yourusername/path_to_script.php > /dev/null 2>&1
Enable Output Emails
If you’d like to receive email updates after each run (to monitor success or troubleshoot errors), remove the > /dev/null 2>&1
part from the command:
/etc/cl.selector/php /home/yourusername/path_to_script.php
In the Email field above the cron job settings, enter the email address where you’d like to receive notifications.
Avoiding Overlapping Cron Jobs
Overlapping tasks can slow down your server and cause errors. To prevent this, use flock
, which ensures only one instance of the cron job runs at a time.
Here’s the format:
/usr/bin/flock -w 1 /tmp/cron.lock /etc/cl.selector/php /home/yourusername/path_to_script.php
/usr/bin/flock
: The path to the Flock binary./tmp/cron.lock
: The temporary lock file.- The rest is your cron job command.
Tips for Optimizing Your Cron Jobs
- Test Your Commands: Run your cron command manually before scheduling it to ensure it works properly.
- Keep Your Scripts Efficient: Optimize scripts to reduce execution time and server load.
- Use Logs: Set up logs to monitor cron job activity and troubleshoot issues.
Also Learn: cPanel Zone Editor: A Beginner-Friendly Guide to Managing DNS Records
At Hostingest, we make managing cron jobs simple with our intuitive cPanel interface and robust hosting environment. With features like 99.9% uptime, free SSL, and advanced tools like LiteSpeed, Softaculous, and Imunify360, your automation tasks will always run without a hitch.
Take your hosting experience to the next level with Hostingest! Start automating today by setting up cron jobs that save you time and effort.