Knowledge Base
How to Set Up a Cron Job in DirectAdmin
Scheduling Automated Tasks
Cron jobs run commands or scripts automatically at scheduled times.
Creating a Cron Job
- Log into DirectAdmin
- Click Cron Jobs
- Set the schedule using the dropdowns or enter values manually
- Enter the command to run
- Click Add
Understanding the Schedule
| Field | Values | Example |
|---|---|---|
| Minute | 0-59 | 30 = at minute 30 |
| Hour | 0-23 | 14 = 2 PM |
| Day of Month | 1-31 | 15 = 15th day |
| Month | 1-12 | 6 = June |
| Day of Week | 0-6 | 0 = Sunday |
Use * for "every" (e.g., * in hour field = every hour)
Common Examples
- Every hour: 0 * * * *
- Every day at midnight: 0 0 * * *
- Every Monday at 3 AM: 0 3 * * 1
- Every 15 minutes: */15 * * * *
WordPress Cron Example
/usr/local/bin/php /home/username/domains/example.com/public_html/wp-cron.php
Silencing Output
Add > /dev/null 2>&1 to prevent email notifications:
/usr/local/bin/php /path/to/script.php > /dev/null 2>&1