Client area
Back to all guides SpicyHost help ยท DirectAdmin

Add a cron job in DirectAdmin

Run a script automatically on a schedule, such as a nightly clean-up or a task every 5 minutes.

1

Log in to your control panel

Open the control panel address from your welcome email. It ends in :2222, for example yourdomain.co.uk:2222. Enter your username and password, then click Sign in.

Control panel login page
The login page.
2

Open Cronjobs

On the home page, scroll to the Advanced Features section and click Cronjobs.

DirectAdmin home page with Cronjobs highlighted
Click Cronjobs under Advanced Features.
3

Set the schedule and command

Under Create a New Cron Job, fill in when it runs. A * means "every". The example runs every 5 minutes:

  • Minute: */5
  • Hour, Day of Month, Month, Day of Week: leave as *

In Command, type php, a space, then the full path to your script:

php /home/yourusername/domains/yourdomain.co.uk/public_html/cron.php

Click Prevent Email if you don't want an email every time it runs, then click Add.

Create a New Cron Job form with the schedule, command and Add button highlighted
No spaces inside the time boxes, e.g. 1,15,30 not 1, 15, 30.
4

Check it's listed

Your cron job now shows in the list below the form. To change or remove it, tick Select and use Edit or Delete.

Cron job list showing the new job
The new job runs every 5 minutes.

Common schedules

Copy the values into the five time boxes, from Minute to Day of Week. Times use the server clock, shown as Current Time above the form.

RunsMinuteHourDay of MonthMonthDay of Week
Every 5 minutes*/5****
Every hour, on the hour0****
Every day at 3am03***
Every Monday at 9am09**1
1st of each month at midnight001**

Always start the command with php for a PHP script. A path on its own, like /home/yourusername/cron.php, won't run. Please don't schedule jobs more often than every 5 minutes.

To call a page by its web address instead of its file path, use:

curl --silent https://yourdomain.co.uk/cron.php > /dev/null