How to Create a Cron Job in DirectAdmin

Cron Jobs allow your hosting account to run scheduled tasks automatically at specific times or intervals.

This guide explains how to create a Cron Job in DirectAdmin.


What Is a Cron Job?

A Cron Job is an automated scheduled task that runs in the background on the server.

Cron Jobs are commonly used for:

  • WordPress scheduled tasks
  • backups
  • email sending
  • website maintenance
  • importing data
  • clearing cache files
  • running scripts automatically

Before You Start

Before creating a Cron Job, make sure:

  • You can log into DirectAdmin
  • You know the command or script that needs to run
  • Your website or application supports Cron Jobs

If you are unsure about the required command, contact your developer or HostworX support.


Important Warning

Incorrect Cron Job settings may:

  • overload websites
  • create server load
  • send repeated email
  • cause website errors

Only create Cron Jobs if you understand what the task is supposed to do.


How to Create a Cron Job

Step 1 — Log Into DirectAdmin

Open your browser and visit:  https://cp.yourdomain.co.za   (Replace yourdomain.co.za with your own domain name)

Enter your hosting username and password.


Step 2 — Open Cron Jobs

From the DirectAdmin dashboard:

Click:  Advanced Features

Then click:  Cron Jobs


Step 3 — Create a New Cron Job

Click:  Create Cron Job


Step 4 — Configure the Schedule

Choose how often the task should run.

Examples include:

  • every minute
  • every hour
  • once per day
  • once per week

Common Schedule Examples

Every 5 Minutes

 
*/5 * * * *
 

Once Per Hour

 
0 * * * *
 

Once Per Day at Midnight

 
0 0 * * *
 

Step 5 — Enter the Command

Enter the command or script path provided by your application or developer.

Example:

 
/usr/local/bin/php /home/username/domains/yourdomain.co.za/public_html/cron.php
 

Step 6 — Save the Cron Job

Click:  Create

The Cron Job is now active.


Common Cron Job Uses

WordPress Scheduled Tasks

Some WordPress websites use Cron Jobs for:

  • scheduled publishing
  • WooCommerce tasks
  • backups
  • maintenance

Sending Automated Email

Cron Jobs can automate:

  • newsletters
  • reports
  • notifications

Running Maintenance Scripts

Useful for:

  • cache cleanup
  • data imports
  • backups
  • synchronization tasks

Important Notes

Avoid Running Cron Jobs Too Frequently

Running tasks too often may:

  • increase server load
  • slow websites
  • create duplicate processes

Test Commands Carefully

Incorrect commands may:

  • fail silently
  • create errors
  • affect website functionality

Keep Cron Jobs Organized

Remove unused Cron Jobs to avoid confusion later.


Troubleshooting

Cron Job Not Running

Check:

  • command spelling
  • file paths
  • file permissions
  • PHP path correctness

Permission Denied Errors

Ensure:

  • scripts are executable
  • file permissions are correct
  • paths are accurate

Cron Job Sends Too Many Emails

This usually happens when:

  • the schedule is too frequent
  • scripts are looping
  • tasks are duplicated

Website Performance Problems

Too many Cron Jobs or badly configured tasks may increase:

  • CPU usage
  • memory usage
  • server load

Helpful Tips

Keep Backup Copies of Scripts

Always keep backups before editing automation scripts.


Use Proper PHP Paths

Many PHP Cron Jobs require the correct PHP binary path.


Monitor Website Performance

After creating Cron Jobs, monitor:

  • website speed
  • email activity
  • error logs

Security Tips

  • Remove unused Cron Jobs
  • Avoid using unknown scripts
  • Keep applications updated
  • Use secure passwords
  • Restrict script permissions where possible
  • website troubleshooting
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Change PHP Version in DirectAdmin

Different websites and applications may require different PHP versions to work correctly. This...

How to Check Disk Usage in DirectAdmin

DirectAdmin allows you to monitor how much disk space your hosting account is using. This guide...

How to Check Which PHP Version Your Website Is Using

Different websites and applications may require different PHP versions....

How to Create a Custom Error Page in DirectAdmin

Custom error pages allow you to display friendly messages when visitors encounter website errors...

How to Suspend a Website Using DirectAdmin

There may be times when you need to temporarily disable access to a website for maintenance,...