A cron job runs a command or script automatically on a schedule. It is useful for tasks like sending reports, clearing caches, or triggering WordPress scheduled events reliably. Here is how to create one in DirectAdmin.
Before you start #
- Know the exact command or script path you want to run.
- Decide how often it should run.
Step-by-step: create a cron job #
- Log in to DirectAdmin (usually yourdomain.com:2222).
- Go to Advanced Features and click Cron Jobs.
- Set the schedule using the minute, hour, day, month, and weekday fields.
- Enter the command to run in the command field.
- Click Add.
Understanding the schedule fields #
- Minute: 0 to 59.
- Hour: 0 to 23.
- Day of month: 1 to 31.
- Month: 1 to 12.
- Day of week: 0 to 6 (0 is Sunday).
- An asterisk (*) means “every”.
Example: 0 3 * * * runs a task every day at 3:00 AM.
Common WordPress example #
To run WordPress cron reliably, you can call wp-cron on a schedule, for example every 15 minutes, using a command your developer or our support team can provide for your setup.
Tips #
- Avoid scheduling heavy tasks too frequently.
- Send output to a log file so you can check results.
- Test the command manually first if possible.
Troubleshooting #
- Job not running: re-check the command path and schedule.
- Too many emails: redirect output to a log instead of email.
- Permission errors: confirm the script is executable.
Need help? #
Cron syntax can be confusing. Contact our support team on live chat and we will help you set the correct schedule.