Setting Up Cron Jobs via DirectAdmin
Explains how to set up a cron job in DirectAdmin to automatically run recurring tasks.
With a cron job, you can have a script or command run automatically at fixed times, for example for a nightly task on your website. In this article, we explain how to set this up in DirectAdmin.
Creating a cron job
- Log in to DirectAdmin via
yourwebsite.com:2222. - Navigate under Advanced Features to Cron Jobs.
- Click Create new Cron Job.
- Enter the schedule under Minute, Hour, Day of Month, Month, and Day of Week. Use an asterisk (
*) for "every", for example every hour or every day. - Enter the full command or full URL you want to run under Command.
- Click Create.
Example
A cron job that calls a script every day at 3:00 AM:
Minute: 0
Hour: 3
Day of Month: *
Month: *
Day of Week: *
Command: php /home/youraccount/domains/yourwebsite.com/public_html/script.php
Note: Preferably use the full, absolute path to your script. A relative path often doesn't work well within a cron job.
Troubleshooting
- Cron job doesn't seem to run: check whether the path to the script is correct and whether the script itself works correctly when tested on its own.
- Emails on every run: DirectAdmin sends an email by default on every run. Add
> /dev/null 2>&1to the end of the command to suppress this. - Script works on its own, but not via cron: this often points to a missing environment variable or a relative path, always use absolute paths in cron jobs.
Still stuck? Feel free to reach out via Discord or create a support ticket.
Anne
Updated on: 10/15/2026
Was this article helpful?
