Home › Cron Jobs in DirectAdmin

How to Add a Cron Job in DirectAdmin

DirectAdmin's cron job interface is straightforward - five fields plus a command. This guide covers setup, PHP paths, the @reboot option and an important warning about editing crontabs directly via SSH.

Where to Find Cron Jobs in DirectAdmin

Log in to DirectAdmin and go to Advanced Features › Cron Jobs. You will see the list of existing cron jobs and a form to create new ones. Official reference: DirectAdmin cron documentation.

DirectAdmin accesses the URL at port 2222 by default: https://yourdomain.com:2222.

Add a Cron Job - Step by Step

1. Fill in the five time fields

Enter values in the Minute, Hour, Day of Month, Month and Day of Week fields. Use * for "every". You can also tick "Run on @reboot" to run the job once when the server starts. The fields accept standard cron syntax including */5, ranges like 1-5 and lists like 1,15.

2. Enter the command

In the Command field, enter the full command with absolute paths. For a PHP script:

/usr/local/bin/php /home/username/domains/domain.com/public_html/script.php

3. Click CREATE

The job appears in the list immediately. DirectAdmin writes it to the user's crontab - you will see the comment #DO NOT EDIT THIS FILE. Change through DirectAdmin if you inspect the file via SSH.

4. Set email notifications

DirectAdmin can email you the output of each cron job run. Enter your email address in the provided field. To silence a specific job, add > /dev/null 2>&1 at the end of the command.

PHP Path in DirectAdmin

PHP in DirectAdmin is typically at /usr/local/bin/php. If you run CustomBuild with multiple PHP versions, the path depends on the version:

PHP versionTypical path in DirectAdmin
System default/usr/local/bin/php
PHP 8.2 (CustomBuild)/usr/local/php82/bin/php
PHP 8.1 (CustomBuild)/usr/local/php81/bin/php
PHP 7.4 (CustomBuild)/usr/local/php74/bin/php

Common Cron Commands in DirectAdmin

TaskExpressionCommand
PHP script daily 0 2 * * * /usr/local/bin/php /home/user/domains/domain.com/public_html/backup.php
Fetch URL every 15 min */15 * * * * /usr/bin/wget -q -O /dev/null https://domain.com/cron.php
Laravel scheduler * * * * * /usr/local/bin/php /home/user/domains/domain.com/public_html/artisan schedule:run >> /dev/null 2>&1
WordPress WP-Cron */5 * * * * /usr/local/bin/php /home/user/domains/domain.com/public_html/wp-cron.php > /dev/null 2>&1
Disable a job temporarily any Add # at the start of the command - the job is kept but skipped

Do not edit the crontab directly via SSH

DirectAdmin manages the crontab file directly and adds the comment #DO NOT EDIT THIS FILE. Change through DirectAdmin. If you edit it via SSH with crontab -e, DirectAdmin may overwrite your changes the next time it writes to the file. Always use the DirectAdmin interface for cron jobs on shared hosting accounts.

Build the cron expression for DirectAdmin

Generate the five field values here, then paste them into DirectAdmin's Minute, Hour, Day, Month and Weekday fields.