Cron is the Linux scheduler that runs commands on schedule: every minute, hour, day etc. Used for backups, cache clearing, newsletters, CMS updates.
How to create a Cron in cPanel:
- cPanel → “Advanced” section → Cron Jobs.
- Use Common Settings (hourly, daily etc.) or enter manually.
- Schedule (5 fields): Minute Hour Day Month Weekday. Examples:
* * * * *— every minute.0 * * * *— every hour at minute 00.0 3 * * *— every night at 3:00.0 0 * * 0— every Sunday at midnight.
- Command — what to run. Examples:
- WordPress cron:
php /home/USER/public_html/wp-cron.php - Script:
cd /home/USER/public_html && php script.php - Curl:
curl -s https://example.tj/cron.php > /dev/null
- WordPress cron:
- Add New Cron Job.
Email notifications:
In the top “Cron Email” field set an address — output (stdout/stderr) of every run goes there. Convenient for debugging. To suppress — add > /dev/null 2>&1 at the end of the command.
Logging:
To preserve output — write to file: php script.php >> /home/USER/cron.log 2>&1.
