What is a Cron Job?

A cron job is a scheduled task that runs automatically at a set time on your server. CloudSonic gives you full root access so you can configure and manage cron jobs however you need.

CloudSonic
CloudSonic
Last Updated September 10, 2026

TL;DR Cron Job

A cron job is a scheduled task that runs automatically on a server at a defined time or interval without any manual input. The name comes from the Unix time-based job scheduler called cron, and the tasks themselves can be anything from sending emails and generating reports to clearing caches and running database maintenance scripts. WordPress relies heavily on cron jobs through its own internal scheduler, WP-Cron, which handles things like publishing scheduled posts, checking for plugin updates, and triggering automated backups. Because CloudSonic gives you full root access to your server, you can set up real server-level cron jobs directly rather than relying on WordPress's less reliable pseudo-cron system, giving you more control and better timing accuracy for critical tasks.

Note WordPress has its own pseudo-cron system called WP-Cron which only fires when someone visits your site, meaning scheduled tasks can be delayed or missed entirely on low-traffic sites.

How a Cron Job Works

The cron daemon is a background process that runs continuously on a Linux server and checks a configuration file called the crontab at regular intervals, typically every minute. The crontab contains a list of scheduled tasks, each with a time expression that specifies when it should run and a command to execute when that time arrives. The time expression uses five fields representing minute, hour, day of month, month, and day of week, allowing you to schedule tasks to run at almost any interval from every minute to once a year. When the scheduled time arrives the cron daemon executes the command automatically without any user input required. The command can be anything the server can run, a PHP script, a shell command, a Python script, or a call to an external API.


# Edit your crontab
crontab -e

# Run a PHP script every hour
0 * * * * /usr/bin/php /var/www/mysite/cron.php

# Clear WordPress transients every day at 3am
0 3 * * * /usr/bin/wp transient delete --all --path=/var/www/mysite/public_html --allow-root

# Run a database backup every day at 2am
0 2 * * * /usr/local/bin/sonic-backup mysite

# Run a script every 15 minutes
*/15 * * * * /usr/bin/php /var/www/mysite/queue.php

# Disable WP-Cron in wp-config.php and replace with real cron
define('DISABLE_WP_CRON', true);

Frequently Asked Questions on Cron Job

What is the difference between a WordPress cron job and a real server cron job?

WordPress has its own pseudo-cron system called WP-Cron that runs scheduled tasks by piggybacking on visitor requests. If no one visits your site, WP-Cron does not run and scheduled tasks are delayed. A real server cron job runs at the exact scheduled time regardless of visitor traffic. For sites with low traffic or time-sensitive scheduled tasks, replacing WP-Cron with a real server cron job is strongly recommended.

How do I create a cron job on my CloudSonic server?

Because CloudSonic gives you full root access via SSH, you can edit the crontab directly using the crontab -e command. Add a line with the time expression and the command you want to run, save the file, and the cron daemon picks it up immediately. No server restart is required.

Can a runaway cron job affect my website performance?

Yes. A cron job that consumes significant CPU or memory, or one that runs more frequently than intended due to a misconfiguration, can compete with web server processes for resources and slow your site. CloudSonic's server monitoring tracks resource usage at the process level so runaway processes are visible before they cause serious impact.