Shared Hosting (cPanel)

Setting Up Cron Jobs

By the Domain India teamPublished 5 min read
Knowledge base article
Contents (4 sections)

A cron job runs a script or command on your hosting account automatically, on a schedule you choose: every 15 minutes, every night, every Monday. You set one up in your control panel's Cron Jobs page by choosing the timing and typing a command with full paths. This page gives you the short version; the full guide covers every detail.

For the full cron guide

Schedules, commands, logging, WordPress and database examples, and troubleshooting are all in How to set up a cron job. For DirectAdmin, see Setting up cron jobs in DirectAdmin.

Key takeaways

In cPanel, open Cron Jobs (in the Advanced section), pick a schedule from Common Settings, type a command such as /usr/local/bin/ea-php83 /home/USERNAME/public_html/cron.php, and click Add New Cron Job. On Domain India shared servers the shortest interval that actually runs is every 4 minutes, and schedules run in Indian Standard Time. You don't need SSH to use cron jobs.

1. Add a cron job in cPanel

  1. Log in to cPanel.
    From the client area, open your hosting service and use the login button, or see how to log in to cPanel.
  2. Open Cron Jobs.
    It is in the Advanced section, or type "cron" in the search box at the top.
  3. Choose the schedule.
    Pick one from Common Settings, or fill in the five fields yourself.
  4. Enter the command.
    Use full paths for the program and the script (section 3).
  5. Click Add New Cron Job.
    The job appears under Current Cron Jobs, where you can edit or delete it.

2. Common schedules

ScheduleCron expression
Every 15 minutes/15 *
Every hour, on the hour0
Every day at 2:30 a.m.30 2 *
Every Sunday at 3 a.m.0 3 0
First day of every month at midnight0 0 1

The five fields are minute, hour, day of month, month and day of week; * means "every". Our cPanel and DirectAdmin servers run on Indian Standard Time, so 30 2 * * * means 2:30 a.m. IST. For more patterns, see the cron expression guide.

Every 4 minutes is the minimum

On our cPanel and DirectAdmin shared servers, an hourly check rewrites any cron job set to run every 1, 2 or 3 minutes to /4, every 4 minutes. A job set to , such as a Laravel scheduler, therefore runs every 4 minutes. If your application truly needs a job every minute, or a process that runs all the time, use a VPS.

3. Common commands

Cron starts with an almost empty environment, so give the full path to everything. Replace USERNAME with your cPanel username and 83 with your site's PHP version.

bash
# Run a PHP script (cPanel)
/usr/local/bin/ea-php83 /home/USERNAME/public_html/cron.php

# Call a URL; the t= part stops a cached reply being used
/usr/bin/curl -s "https://example.com/cron.php?t=$(date +\%s)" >/dev/null 2>&1

# Delete temporary files older than 7 days
find /home/USERNAME/tmp -type f -mtime +7 -delete

In a cron command, write every % as \%, because cron treats a bare % as a line break. On DirectAdmin, the PHP binary is /usr/local/php83/bin/php and sites live in /home/USERNAME/domains/DOMAIN/public_html.

4. Tips

  • Log while testing. Add >> /home/USERNAME/cron.log 2>&1 to the end of the command, read the log, then switch to >/dev/null 2>&1 once the job works.
  • Stop the emails. cPanel emails any output to the Cron Email address at the top of the page. Discard output or clear that address once the job is proven.
  • Test without SSH. You don't need a shell: create scripts in the File Manager and check the log. Jailed SSH is available on every shared plan if you want it; it is off by default, so ask support to enable it.
  • PHP limits apply. Functions such as exec, proc_open and popen are disabled for command-line PHP too; see PHP disabled functions on shared hosting.
cPanel Starter
₹125/mo + GST
  • 25 GB NVMe SSD Storage
  • 50 GB Monthly Bandwidth
  • 1 Website
  • 10 Email Accounts
See plan details

Prices on the cards exclude 18% GST.

Where do I set up a cron job in cPanel?

Open Cron Jobs in the Advanced section of cPanel, or type "cron" into the search box. Choose a schedule, enter the command with full paths, and click Add New Cron Job.

What is the shortest cron interval on Domain India shared hosting?

Four minutes. An hourly check on our cPanel and DirectAdmin shared servers changes jobs set to run every 1, 2 or 3 minutes to every 4 minutes. For a job every minute, use a VPS.

Do I need SSH to use cron jobs?

No. Cron jobs are created in the control panel and run for your account whether or not SSH is enabled.

What time zone do cron jobs use?

Our cPanel and DirectAdmin shared servers run on Indian Standard Time, so a job set for hour 2 runs at 2 a.m. IST.

How do I stop cron jobs sending me emails?

Add >/dev/null 2>&1 to the end of the command to discard all output, or send it to a log file instead. You can also clear the Cron Email address on the Cron Jobs page.

Ready to automate a task? Follow the full cron job guide, or compare cPanel hosting plans. If a job won't run, open a support ticket with the exact command and the error from your log.

Hosting that runs your scheduled tasks

Cron jobs, multiple PHP versions and weekly backups on every shared hosting plan, managed from your control panel.

See cPanel hosting plans

Ready when you are

Get cPanel hosting from ₹125/mo + GST

See plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Setting Up Cron Jobs in cPanel: Quick Guide | Domain India