Cron Jobs & Scheduled Tasks

Setting Up Cron Jobs in DirectAdmin

By the Domain India teamPublished 4 min read
Knowledge base article
Contents (4 sections)

To set up a cron job in DirectAdmin, open Cron Jobs, fill in the five time fields, type the full command, and save. The job then runs on that schedule under your hosting account. This page gives you the quick version; on Domain India servers, remember that the shortest interval that actually runs is every 4 minutes.

For the full DirectAdmin guide

The complete walk-through, with PHP paths, logging and troubleshooting, is in Setting up cron jobs in DirectAdmin. For cron in general, see How to set up a cron job.

Key takeaways

Open Cron Jobs in DirectAdmin, set minute, hour, day of month, month and day of week, and enter a command with full paths, for example /usr/local/php83/bin/php /home/USERNAME/domains/example.com/public_html/cron.php. Jobs set to run every 1, 2 or 3 minutes are changed to every 4 minutes automatically on our servers. Schedules run in Indian Standard Time.

1. Add a cron job

  1. Log in to DirectAdmin.
    From the client area, open your hosting service and use the login button.
  2. Open Cron Jobs.
    It is listed with the advanced tools. If you can't see it, type "cron" into the search box at the top of DirectAdmin.
  3. Set the schedule.
    Fill in the five fields. * means "every".
  4. Enter the command.
    Use full paths for the program and the script.
  5. Save and check.
    The job appears in the list of current cron jobs, where you can change or delete it later.
DirectAdmin Cron Jobs page with Create Cron Job and Send All Cron Output to E-mail buttons and columns for the schedule and command
The Cron Jobs page in DirectAdmin, under Advanced Features.

You don't need SSH to create or run cron jobs.

2. The schedule fields

FieldAllowed valuesExampleMeaning of the example
Minute0-59*/15Every 15 minutes
Hour0-232At 2 a.m. IST
Day of month1-311On the 1st
Month1-12*Every month
Day of week0-7 (0 and 7 = Sunday)1-5Monday to Friday
Every 4 minutes is the minimum

On our cPanel and DirectAdmin shared servers, an hourly check rewrites any cron job set to run every 1, 2 or 3 minutes to */4, every 4 minutes. A Laravel scheduler set to "every minute" therefore runs every 4 minutes. If you need a job every minute, or a process that runs all the time, use a VPS.

3. The command

Each PHP version has its own binary on our DirectAdmin server, for example /usr/local/php83/bin/php. Use the version your site runs on, and the full path to the script:

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

To keep the output while you test, add >> /home/USERNAME/cron.log 2>&1 to the end. Once the job works, use >/dev/null 2>&1 to discard it. In a cron command, write every % as \%.

Functions such as exec, proc_open and shell_exec are disabled for command-line PHP as well as websites, so scripts that need them fail from cron too. See PHP disabled functions on shared hosting.

Frequently asked questions

Where are cron jobs in DirectAdmin?

Open Cron Jobs from DirectAdmin's advanced tools, or type "cron" into the search box at the top of the panel. The page lets you add a job and lists your current jobs so you can change or delete them.

What is the shortest cron interval on Domain India DirectAdmin hosting?

Four minutes. An hourly check on our cPanel and DirectAdmin shared servers changes jobs set to every 1, 2 or 3 minutes to every 4 minutes. For a job every minute, use a VPS.

What PHP path should I use in a DirectAdmin cron job?

Use the versioned binary, for example /usr/local/php83/bin/php, followed by the full path to your script in /home/USERNAME/domains/DOMAIN/public_html. Change 83 to the PHP version your site uses.

Which time zone do DirectAdmin cron jobs use?

Our DirectAdmin server runs on Indian Standard Time, so a job set for hour 2 runs at 2 a.m. IST.

Ready to schedule a job? Follow the full DirectAdmin cron guide, check your timing with the cron expression guide, or compare DirectAdmin hosting plans. If a job still won't run, open a support ticket with the exact command and the error from your log.

DirectAdmin hosting with cron built in

Schedule scripts, backups and cleanups from your panel on every DirectAdmin plan.

See DirectAdmin plans

Ready when you are

Get DirectAdmin hosting from ₹100/mo + GST

See plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app