Cron jobs let you schedule commands to run automatically at specific times on your GoZen shared hosting or VPS. Use them for database backups, cleanup scripts, sending scheduled emails, or running WordPress maintenance tasks.

Cron Jobs in cPanel

  1. Log in to cPanel
  2. Go to Advanced > Cron Jobs
  3. Set the schedule using the time fields:
FieldWhat It MeansExample
Minute0-590 = top of the hour
Hour0-233 = 3 AM
Day1-311 = first of the month
Month1-12* = every month
Weekday0-7 (0 and 7 = Sunday)1 = Monday
  1. Enter the command
  2. Click Add New Cron Job

Common Cron Schedules

ScheduleMinuteHourDayMonthWeekday
Every 5 minutes*/5****
Every hour0****
Every day at 3 AM03***
Every Monday at midnight00**1
First of every month001**

Common Cron Commands

Run WordPress cron (replace WP’s built-in pseudo-cron):

  /usr/local/bin/php /home/username/public_html/wp-cron.php > /dev/null 2>&1
  

Back up a database daily:

  /usr/bin/mysqldump -u dbuser -p'password' database_name > /home/username/backups/db_$(date +\%Y\%m\%d).sql
  

Delete old log files (older than 30 days):

  find /home/username/logs/ -name "*.log" -mtime +30 -delete
  

Clear the WordPress transient cache:

  /usr/local/bin/wp transient delete --all --path=/home/username/public_html/
  

Output suppression: Add > /dev/null 2>&1 to the end of commands to prevent cron from sending you an email every time it runs.

Cron Jobs on a VPS (Command Line)

On a VPS with SSH access, use the crontab command:

  # Edit your cron jobs
crontab -e

# List current cron jobs
crontab -l
  

Crontab Syntax

  # m   h   dom mon dow  command
  0   3   *   *   *    /usr/local/bin/php /var/www/yourdomain.com/wp-cron.php
  0   */6 *   *   *    /usr/bin/certbot renew --quiet
  30  2   *   *   0    /home/user/scripts/weekly-backup.sh
  

System-Wide Cron Jobs

For root-level tasks:

  sudo nano /etc/crontab
  

Or place scripts in the appropriate directory:

DirectoryRuns
/etc/cron.hourly/Every hour
/etc/cron.daily/Every day
/etc/cron.weekly/Every week
/etc/cron.monthly/Every month

WordPress and Cron

WordPress uses a “pseudo-cron” system (wp-cron.php) that runs on every page load. This is inefficient because:

  • It adds processing time to every page load
  • It doesn’t run if nobody visits your site
  • It can cause duplicate execution under high traffic

Better approach: Disable WP-Cron and use a real server cron:

  1. Add to wp-config.php:

      define('DISABLE_WP_CRON', true);
      
  2. Add a cPanel cron job (every 5 minutes):

      */5 * * * * /usr/local/bin/php /home/username/public_html/wp-cron.php > /dev/null 2>&1
      

Troubleshooting

ProblemFix
Cron not runningCheck the command path. Use full paths (e.g., /usr/local/bin/php, not just php).
Getting email every time cron runsAdd > /dev/null 2>&1 to suppress output
Command works manually but not in cronCron uses a minimal environment. Use absolute paths for everything.
Permission deniedMake sure scripts are executable: chmod +x script.sh

Last updated 19 Apr 2026, 23:46 +0300. history

Was this page helpful?