Support 24/7 Service status
Hosting
Email
Discounts
Help
Company
Sign in Support 24/7
Get started

Setting up cron jobs (scheduled tasks)

Run a script on a schedule with a cron job in DirectAdmin: how the five time fields work, ready-made examples for WordPress and PHP, and how to see what went wrong.

Updated 16 November 2026

A cron job runs a command on a schedule: every five minutes, every night at 3 am, every Monday. Apps use them for things like sending queued emails, clearing caches or running a shop's scheduled tasks.

Cron jobs are included on every hosting plan; the plan comparison shows what each plan includes.

Add a cron job

  1. Open DirectAdmin from your service page (one-click login).
  2. Go to Advanced Features → Cron Jobs.
  3. Fill in when it should run (the five time fields, explained below) and the command.
  4. Choose Create.

The five time fields

From left to right: minute (0–59), hour (0–23), day of the month (1–31), month (1–12) and day of the week (0–7, where 0 and 7 are both Sunday). A * means "every".

Minute Hour Day Month Weekday Runs
*/5 * * * * Every 5 minutes
17 * * * * Every hour, at 17 minutes past
30 3 * * * Every day at 3:30 am
0 9 * * 1 Every Monday at 9 am
0 0 1 * * At midnight on the 1st of each month

The times are in the server's time zone, which may not be yours. If the exact time matters, find out first: set up the output email (see Getting the output), add a job with the command date that runs once in the next few minutes, and the email shows the server's time. Delete the job afterwards.

Pick an odd minute, like 17 instead of 0, when the exact time doesn't matter. Lots of jobs everywhere start on the hour, so an odd minute tends to run faster.

Example commands

Replace USERNAME with your DirectAdmin username and example.com with your domain.

A PHP script:

/usr/local/bin/php /home/USERNAME/domains/example.com/public_html/cron.php

Open a web address (for apps that give you a "cron URL"):

curl -fsS "https://example.com/cron?key=YOUR-KEY" > /dev/null

WordPress: a real cron instead of WP-Cron

By default WordPress only runs its scheduled tasks when someone visits the site. On a quiet site they can run late, and on a busy one they add work to page loads. To use a real cron job instead:

  1. Add this line to wp-config.php, above the line that says That's all, stop editing:

    define('DISABLE_WP_CRON', true);
    
  2. Add a cron job that runs every 15 minutes (*/15 * * * *):

    /usr/local/bin/php /home/USERNAME/domains/example.com/public_html/wp-cron.php > /dev/null 2>&1
    

Getting the output

Fill in Send all Cron output to E-Mail address at the top of the Cron Jobs page and you'll get an email whenever a job prints something, which is the quickest way to see an error. Once it works, add > /dev/null 2>&1 to the end of the command to stop the emails.

If a job doesn't run

  • Check the path. Use the full path to both the program (/usr/local/bin/php) and the script. Cron doesn't start in your website's folder.
  • Run it by hand first. Open the script's web address, if it has one, and check it works before scheduling it.
  • Don't run it too often. A job that takes longer than its interval starts piling up. Every 5 minutes is the most most apps need.

Stuck? Open a ticket with the command and the schedule, and we'll take a look.

Still stuck?

Open a ticket and a real person will help you, any time of day.

Open a ticket Other ways to reach us

Ready to go live?

Pick a plan in a minute and your site's ready shortly after.

Get started