Complete Guide to Setting Up and Managing Cron Jobs in DirectAdmin

Priya

Content Writer & Researcher

Last Updated: 8 October 2026
Complete Guide to Setting Up and Managing Cron Jobs in DirectAdmin
πŸ–₯️

Stop Doing Server Tasks Manually β€” Let CloudHouse Automate It

From cron job configuration to full server monitoring, CloudHouse Technologies manages your DirectAdmin servers so you can focus on growth. Get expert help today.

πŸ–₯️12,400+PCs Fixed
⭐4.9β˜…Google Rating
⚑<15 minAvg. Response
πŸ›‘οΈISO 27001Certified

If you manage websites or servers through DirectAdmin, knowing how to set up cron jobs in DirectAdmin is one of the most valuable automation skills you can have. Cron jobs let your server run scripts automatically β€” backups at 2 AM, database cleanups every Sunday, SSL renewal checks weekly β€” without you lifting a finger. But DirectAdmin's cron interface has quirks that trip up even experienced sysadmins, especially if you're coming from cPanel.

This guide walks you through everything: accessing the cron manager, understanding cron syntax, creating jobs for real-world scenarios, and fixing the most common errors (permission denied, command not found, jobs that silently never run).

What Is a Cron Job and Why Use One?

A cron job is a time-based task scheduler built into Linux. It runs any command or script at a schedule you define β€” once a minute, daily at midnight, or on the first of every month. On a DirectAdmin hosting server, cron jobs are managed per-user account through the panel UI or directly via the system's crontab.

Common use cases for hosting admins:

  • Automated database backups
  • WordPress scheduled tasks and maintenance scripts
  • SSL certificate renewal checks
  • Log file rotation and cleanup
  • Sending scheduled reports or alerts
  • Running PHP-based cron scripts for e-commerce or CMS platforms

The key difference between DirectAdmin and cPanel cron jobs: DirectAdmin crons execute from the system root directory (/), not from public_html. This is the number one reason cron jobs fail after migrating from cPanel β€” relative paths in scripts simply don't resolve.

πŸ’‘ None of these worked? Skip the guesswork.

Get Expert Help β†’

Accessing the DirectAdmin Cron Job Manager

1Log in to DirectAdmin

Navigate to your DirectAdmin control panel (typically yourdomain.com:2222) and log in with your user credentials.

2Find Cron Jobs in the menu

In the Evolution skin (newer DA): go to Advanced Features β†’ Cron Jobs.

In the Enhanced skin (classic DA): look in the Your Account section for Cron Jobs.

3Verify cron is enabled on your account

If you don't see a Cron Jobs link, the feature may be disabled at the reseller or admin level. Contact your hosting provider to enable it via Profile Setup β†’ Account Configuration.

1Open the Cron Jobs manager

Follow the steps above to navigate to Advanced Features β†’ Cron Jobs.

2Click "Create Cron Job"

You'll see a form with fields for each schedule component: Minute, Hour, Day of Month, Month, Day of Week, and Command.

3Fill in the schedule fields

Enter numeric values or * in each field. For "every 5 minutes", enter */5 in the Minute field and * in all other time fields.

4Enter the command with full absolute paths

This is the most critical step. Always use the full path to the interpreter AND the script:

/usr/local/bin/php -q /home/yourusername/public_html/cron.php

Never use relative paths like php cron.php β€” DirectAdmin crons run from /, so relative paths will fail silently.

5Set the email address (optional)

DirectAdmin can email you any output from the cron job. Enter your address to receive output, or leave blank to suppress all emails. To capture errors to a log file instead:

/usr/local/bin/php -q /home/user/public_html/cron.php >> /home/user/logs/cron.log 2>&1
6Save and verify

Click Add. The job appears in your cron list. To test it, manually run the command from your SSH terminal first to confirm it executes without errors before relying on the scheduler.

Real-World Cron Job Scenarios for Hosting Admins

Automated Database Backup

# Daily at 2 AM β€” dump all databases to a backup directory
0 2 * * * /usr/bin/mysqldump -u dbuser -pdbpassword mydatabase > /home/user/backups/db_$(date +\%Y\%m\%d).sql

WordPress Cron (Disabling wp-cron and Using Real Cron)

WordPress's built-in wp-cron runs on every page load, wasting server resources. Replace it with a real cron job:

First, add to wp-config.php: define('DISABLE_WP_CRON', true);

Then create a cron job in DirectAdmin:

*/15 * * * * /usr/local/bin/php -q /home/user/public_html/wp-cron.php >/dev/null 2>&1

Log File Cleanup

# Every Sunday at 3 AM β€” delete log files older than 30 days
0 3 * * 0 find /home/user/logs/ -name "*.log" -mtime +30 -delete

Let's Encrypt SSL Check

# Daily at 3:30 AM β€” renew SSL certificates if expiring within 30 days
30 3 * * * /usr/bin/certbot renew --quiet

Troubleshooting Common DirectAdmin Cron Job Issues

Cron job never runs

First, verify the cron daemon is active:

systemctl status crond   # RHEL/CentOS/AlmaLinux
systemctl status cron    # Debian/Ubuntu

Also confirm the feature is enabled in your DirectAdmin account (Profile Setup β†’ Account Configuration).

Exit code 126 β€” Permission Denied

The script isn't executable. Fix the permission chain β€” every directory in the path must be accessible:

chmod 0755 /home/user
chmod 0755 /home/user/scripts
chmod 0755 /home/user/scripts/backup.sh

For PHP files called directly: chmod 0644 is fine since the PHP interpreter reads the file, not executes it.

Exit code 127 β€” Command Not Found

You're using a relative path or a command name that isn't in the system PATH when cron runs. Find the full path with:

which php       # Returns: /usr/local/bin/php
which mysqldump # Returns: /usr/bin/mysqldump

Use those full paths in your cron command.

Script runs manually but not via cron

This is almost always a PATH or working directory issue. Your shell has a rich PATH set in ~/.bashrc; cron runs with a minimal PATH (/usr/bin:/bin). Fix: add the full path to every command inside your script, or add at the top of your script:

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Email flooding from cron output

Redirect output to suppress emails:

# Suppress all output
*/5 * * * * /command >/dev/null 2>&1

# Keep errors, suppress normal output
*/5 * * * * /command >/dev/null

Checking cron execution logs

# RHEL/CentOS/AlmaLinux/Rocky
tail -f /var/log/cron

# Debian/Ubuntu
grep CRON /var/log/syslog | tail -20

Best Practices for Production DirectAdmin Servers

  • Always test the command in SSH first β€” run it manually and confirm it works before scheduling
  • Use absolute paths everywhere β€” in both the cron command and inside your scripts
  • Log output to a file rather than emailing or discarding it β€” logs help you debug failures at 3 AM
  • Avoid scheduling heavy jobs during peak hours β€” use early morning (2-5 AM) for backups and maintenance
  • Stagger multiple cron jobs β€” don't run 5 jobs at exactly midnight, spread them across different minutes
  • Document each cron job in a README or your server notes with what it does, why, and who owns it
  • Replace WordPress wp-cron with a real DirectAdmin cron job on any production WordPress site

Managing cron jobs correctly transforms your DirectAdmin server from a system you have to babysit into one that runs itself. For complex multi-server setups or if you want professional server management that handles scheduling, monitoring, and incident response, CloudHouse Technologies' server management service keeps your infrastructure running 24/7 without you having to stay up to watch it.

Get the Free Linux Server Admin Cheatsheet (PDF)

Essential commands for server management, networking, and troubleshooting β€” all on one printable page.

Running Linux servers? Let us manage them for you.

Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response β€” so your servers stay up and your team stays focused.

  • Proactive OS patching and security updates
  • 24Γ—7 monitoring with instant alerting
  • Backup configuration and disaster recovery
  • Dedicated Linux engineers on call
See Pricing Plans β†’

What our customers say

β€œOur production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

Arun S.

CTO, SaaS Startup

β€œThey migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

Deepak N.

DevOps Lead

Frequently Asked Questions

Log into DirectAdmin and go to Advanced Features β†’ Cron Jobs. Click 'Create Cron Job', enter your schedule in the five time fields (minute, hour, day of month, month, day of week), and enter the full absolute path command (e.g. /usr/local/bin/php -q /home/user/public_html/cron.php). Save and test by running the command manually in SSH first.

Need this done for you?

Server Management Service

Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

Learn more

Book your free 15-minute diagnosis

A certified technician will call you back within 15 minutes during business hours.

Share this article

Leave a Comment

Comments (0)

Loading comments...