How to Create a Cron Job in DirectAdmin

Cron jobs allow you to automate tasks on your website—like running backups, clearing logs, sending scheduled emails, or updating scripts. DirectAdmin makes it easy to set up and manage cron jobs.

Follow the steps below:



Step 1: Log in to DirectAdmin

Use your hosting login details to access your DirectAdmin dashboard.



Step 2: Go to “Cron Jobs”

On the main dashboard:

  1. Click Advanced Features

  2. Select Cron Jobs

This is where you create and manage your automated tasks.



Step 3: Click “Create Cron Job”

You will see a form where you can set:

  • Minute

  • Hour

  • Day

  • Month

  • Weekday

  • Command

These define when and what the cron job will run.

Step 4: Choose Your Cron Schedule

You can set it manually or use the quick presets.

Common Examples:

  • Every 5 minutes:
    */5 * * * *

  • Once daily at midnight:
    0 0 * * *

  • Once weekly (Sunday 12am):
    0 0 * * 0

  • Once monthly (1st of every month):
    0 0 1 * *

You can also use DirectAdmin’s dropdowns to auto-fill these values—no coding required.



Step 5: Add Your Command

A cron job needs a command to run. Examples:

PHP Script

Backup Script

WordPress Cron (optional)

If disabling WP-Cron:

Replace yourdomain.com and username with your actual details.



Step 6: Click “Create”

Your cron job is now active and will run automatically according to your schedule.



Step 7: Manage Your Cron Jobs

Under the same page, you can:

  • Edit existing cron jobs

  • Disable or enable tasks

  • Delete old cron jobs

This helps you keep everything organized.



Tips & Best Practices

  • Don’t run heavy tasks too frequently they may slow your site.

  • Use accurate script paths to avoid errors.

  • Test your script manually before automating.

  • Keep cron jobs minimal for shared hosting environments.

Summary:

To create a cron job in DirectAdmin:

  1. Log in

  2. Go to Advanced Features → Cron Jobs

  3. Set your time schedule

  4. Add your command

  5. Click Create

Your task will now run automatically at the specified time.

Watch the video below: