Setting Up Cron Jobs
Cron jobs run commands automatically on a schedule.
Create a Cron Job
- DirectAdmin → Cron Jobs → Create New Cron Job.
- Set schedule fields (minute, hour, day, month, weekday).
- Enter the command.
- Click Add.
Schedule Reference
| Schedule | Cron Expression |
|---|---|
| Every 5 minutes | */5 * * * * |
| Every hour | 0 * * * * |
| Daily at midnight | 0 0 * * * |
| Every Monday 9am | 0 9 * * 1 |
WordPress WP-Cron (External)
Disable WP's built-in pseudo-cron and use a real cron job instead for better reliability:
In wp-config.php:
define('DISABLE_WP_CRON', true);
Add cron job:
*/5 * * * * /usr/local/bin/php /home/yourusername/public_html/wp-cron.php > /dev/null 2>&1
Suppress Cron Email Output
Append > /dev/null 2>&1 to any command to silence output emails:
0 * * * * your-command > /dev/null 2>&1