A cron job is a scheduled task that your server runs automatically at set times — every hour, every night, once a week, whatever you need. They’re the backbone of automation: running backups, triggering WordPress tasks, sending reports, cleaning up files. Here’s how to set them up in cPanel.

Opening Cron Jobs

In cPanel, under the Advanced section, click Cron Jobs. You’ll see a form for adding a new job and a list of any existing ones.

Understanding the schedule

A cron schedule has five time fields: minute, hour, day of month, month, and day of week. cPanel helpfully provides Common Settings presets — like “Once Per Day” or “Every 15 Minutes” — that fill these in for you. For most tasks, a preset is all you need, so you don’t have to memorise the syntax.

If you do want to set a custom time, the pattern */15 * * * * means “every 15 minutes”, and 0 3 * * * means “at 3am every day”. The asterisks mean “every”.

Writing the command

The Command field is the task to run. Common examples:

Trigger a WordPress cron reliably:

wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Run a PHP script:

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

The >/dev/null 2>&1 at the end suppresses output so you don’t get an email every time the job runs.

Managing cron email

By default, cron emails you the output of every job, which quickly becomes noise. At the top of the Cron Jobs page you can set the email address for notifications, or leave it blank. Adding >/dev/null 2>&1 to a command silences that specific job while still letting it run.

Testing your job

After adding a job, it’s worth confirming it actually runs. Set it to run a couple of minutes ahead, wait, and check the result — a file was created, a backup appeared, a task fired. Once you’ve confirmed it works, set it to its real schedule.

Common uses on our hosting

The most frequent cron jobs we set up for clients are reliable WordPress cron triggers (which fix missed scheduled posts) and automated backups. Both make a site more dependable with no ongoing effort.

Not sure how to write the command for your task? Tell us what you want automated and we’ll help you build the right cron job.

Was this article helpful to you?

admin

Leave a Reply

You must be logged in to post a comment.