Setting Up Cron Jobs via DirectAdmin

Back to Webhosting

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

  1. Log in to DirectAdmin via yourwebsite.com:2222.
  2. Navigate under Advanced Features to Cron Jobs.
  3. Click Create new Cron Job.
  4. 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.
  5. Enter the full command or full URL you want to run under Command.
  6. 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>&1 to 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?