How to Set Up a Cron Job
A cron job runs a command or script automatically on a schedule you define — for example, clearing a cache every hour, sending a daily report, or running a CMS's scheduled tasks. GrabbyHost's cPanel and DirectAdmin ho...
9 views
A cron job runs a command or script automatically on a schedule you define — for example, clearing a cache every hour, sending a daily report, or running a CMS's scheduled tasks. GrabbyHost's cPanel and DirectAdmin hosting both include a cron job manager so you can set these up yourself.
On cPanel
- Log in to cPanel and open Cron Jobs under the Advanced section.
- Under "Add New Cron Job," choose how often it should run using the Common Settings dropdown (for example, Once Per Day), or set custom minute/hour/day/month/weekday values if you need a specific schedule.
- In the Command field, enter the command to run — for a script this is often something like
php -q /home/username/public_html/cron.php(adjust the path to match your actual file location). - Click Add New Cron Job to save it.
On DirectAdmin
- Log in to DirectAdmin and open the Cron Jobs section.
- Add a new cron job, setting the minute/hour/day/month/weekday fields for your schedule.
- Enter the command to run, then save.
Understanding the Schedule Fields
Cron schedules use five fields, in this order: minute (0–59), hour (0–23), day of month (1–31), month (1–12), and day of week (0–6, where 0 is Sunday). An asterisk (*) means "every value." For example, 0 3 * * * runs once a day at 3:00 AM, and */15 * * * * runs every 15 minutes. Most control panels also offer common presets (hourly, daily, weekly, monthly) so you don't have to build the schedule by hand.
Common Uses
- Running a CMS's built-in scheduled tasks (many platforms recommend a real server cron job instead of relying on page-load-triggered scheduling for reliability).
- Clearing temporary files or caches on a regular interval.
- Triggering a script that sends scheduled emails or reports.
- Running backup or maintenance scripts you've written yourself.
Good to Know
Cron jobs run under your hosting account, so a broken or overly frequent job can use up resources or send unwanted output as email — check the "send output to" or notification email field in your cron job settings if you want to control that. If a scheduled task isn't running as expected, double-check the command path is correct and that the file has the right permissions to execute.
Related Articles
- Getting Started with cPanel
- How to Upload Website Files (File Manager & FTP)
- cPanel Features Guide: Everything You Can Do in cPanel
Was this answer helpful?Your response helps us improve future guides.