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
Navigate to your DirectAdmin control panel (typically yourdomain.com:2222) and log in with your user credentials.
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.
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.
Follow the steps above to navigate to Advanced Features → Cron Jobs.
You'll see a form with fields for each schedule component: Minute, Hour, Day of Month, Month, Day of Week, and Command.
Enter numeric values or * in each field. For "every 5 minutes", enter */5 in the Minute field and * in all other time fields.
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.
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
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.
