How to Set Up a Cron Job in DirectAdmin #
A cron job is a scheduled task that runs automatically on the server at times you define — useful for running scripts, sending automated reports, cleaning up files, or triggering maintenance tasks without manual intervention.
To access the DirectAdmin cron jobs interface:
- Log in to your DirectAdmin control panel by accessing https://yourdomain:2222
- Look for the Cron Jobs link and click on it
- Choose now when the new cron job will run. Select minute, hour, day of the month, month, day of the week. Notice that the * sign means every minute, hour, etc
- Choose the Command. This is usually a path to a file/script that will be executed
- You can also configure an email address to receive details when the cron jobs run. Just enter the email in the Email field. Leave this field blank if you don’t want to receive such emails.
Depending on the server configuration, you may need to change the file permission for the script you want to run via a cron job to 755.
Example: to run a script every day at 2:00 AM, set:
Minute: 0 Hour: 2 Day: * Month: * Weekday: *
Depending on your server configuration, you may need to set the file permission on your script to 755 for the cron job to execute it successfully.
Using Cron Jobs with WordPress #
WordPress’s built-in scheduler (WP-Cron) only runs when someone visits your site — which can make scheduled posts, backups, or plugin tasks run late on low-traffic sites. A common fix is to disable WP-Cron’s default behavior and instead set up a real server cron job to trigger `wp-cron.php` on a fixed schedule (e.g., every 15 minutes). Contact us if you’d like help setting this up.