H
10Corp Premium Hosting

How to Set Up Cron Jobs

Last Updated: March 2026 3 min read

How to Set Up Cron Jobs

Cron jobs allow you to schedule commands or scripts to run automatically at specified intervals on your hosting server. They’re commonly used for tasks like sending scheduled emails, running backups, cleaning up temporary files, and updating database records.

Setting Up a Cron Job in cPanel

  1. Log into cPanel.
  2. Navigate to Advanced > Cron Jobs.
  3. Under Cron Email, optionally set an email address to receive output from cron job executions.
  4. Under Add New Cron Job, configure the schedule:
    • Common Settings: Select a preset schedule from the dropdown (e.g., “Once Per Hour”, “Once Per Day”).
    • Custom Schedule: Set individual fields for Minute, Hour, Day, Month, and Weekday.
  5. In the Command field, enter the command to execute.
  6. Click Add New Cron Job.

Understanding Cron Schedule Syntax

The schedule follows this format:

* * * * *
│ │ │ │ │
│ │ │ │ └── Day of Week (0-7, Sun=0 or 7)
│ │ │ └──── Month (1-12)
│ │ └────── Day of Month (1-31)
│ └──────── Hour (0-23)
└────────── Minute (0-59)

Common Schedule Examples

ScheduleCron ExpressionDescription
Every minute* * * * *Runs every minute
Every 5 minutes*/5 * * * *Runs every 5 minutes
Every hour0 * * * *Runs at the top of every hour
Every day at midnight0 0 * * *Runs once daily at 12:00 AM
Every Monday at 3 AM0 3 * * 1Runs weekly on Monday at 3:00 AM
First of each month0 0 1 * *Runs on the 1st of every month

Common Cron Job Commands

Run a PHP script:

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

Run a WordPress cron:

/usr/local/bin/php /home/username/public_html/wp-cron.php

Run a shell script:

/bin/bash /home/username/scripts/backup.sh

Fetch a URL (trigger a web-based script):

/usr/bin/curl -s https://yourdomain.com/cron-task.php > /dev/null 2>&1

Tips and Best Practices

  • Suppress output by appending > /dev/null 2>&1 to your command to avoid receiving emails for every execution.
  • Use full paths to executables (e.g., /usr/local/bin/php instead of just php). Find the path with which php via SSH.
  • Test your script manually via SSH before scheduling it as a cron job.
  • Avoid running jobs too frequently on shared hosting to prevent exceeding resource limits.
  • Set the cron email during testing to debug issues, then disable it for production.

Managing Existing Cron Jobs

In cPanel under Cron Jobs > Current Cron Jobs, you can:

  • Edit a cron job’s schedule or command
  • Delete cron jobs that are no longer needed

Troubleshooting

  • Cron not running: Ensure the command path is correct. Test it via SSH first.
  • Permission denied: Make sure the script has execute permission (chmod +x script.sh).
  • No output: Check the cron email for error messages, or log output to a file.

For help setting up cron jobs, contact 10Corp support.

Tags: hosting cron automation scheduled-tasks cpanel

Still need help?

Our support team is available 24/7 to assist you.