EXPLORE CLOUDWAYS
Experience lightning-fast loading times and seamless platform
View Demo > A Cloudways tutorial on automating repetitive server and site tasks with cron jobs, plus how the Cron Optimizer keeps WordPress tasks running on schedule even with low traffic.
✨ What you’ll learn
✦ What a cron job is and common uses: backups, cleanups, monitoring, and maintenance.
✦ The difference between server-side cron and WP-Cron, and when to use each.
✦ How to create a cron job on Cloudways with predefined schedules or custom cron expressions.
✦ How to enable Cron Optimizer so WP-Cron runs on a fixed schedule regardless of visitors.
In this video, we’ll show you how to use cron jobs to automate routine tasks on your server or website. Whether it’s scheduling backups, cleaning up files, or running scripts, cron lets you handle it all automatically, no manual work needed.
Let’s start with the basics. What exactly is a cron job? Think of cron as your server’s built-in assistant. It’s a tool available on Unix-like and Linux systems that allows you to schedule tasks to run at specific times or intervals. Instead of logging in to run the same commands over and over, you can set them up once with cron and your server takes care of the rest.
Here are some common ways cron jobs can save you time by handling repetitive tasks automatically. Cleanups: automatically remove temporary files or old logs. Backups: schedule regular backups for your site or databases. Monitoring: track disk usage or system health and send alerts. Database and file management: optimize tables or update files on a schedule. System maintenance: run updates or security scans without logging in every time.
There are two main types of cron jobs, and knowing the difference helps you pick the right tool for the job. Server-side cron jobs run directly on your server. You can set them to run every five minutes, once an hour, or on a custom schedule. These are ideal for system-wide tasks or resource-heavy operations. WP-Cron is specific to WordPress. It schedules things like publishing posts, checking for plugin updates, or sending emails. But here’s the catch. WP-Cron doesn’t run on time. It’s only triggered when someone visits your site. So if your site has low traffic, tasks might not run when expected. Depending on your goals, you might choose one over the other, or even both.
Let’s walk through how to create a cron job on the Cloudways platform. It’s simple and only takes a few steps. Log into your Cloudways account, go to the Applications tab. Choose the application you want to add the cron job to. Scroll down to Cron Job Management, click Add New Cron Job.
Here you can choose how frequently you want the task to run. Use the dropdown for predefined options, or set your own custom schedule using cron expressions. Next, choose the type of command to run. Paste your command or script in the box, then click Submit. Your job will now appear under the Basic tab. And if you want more control, switch to the Advanced tab to fine-tune your cron job with detailed timing, environment variables, or additional parameters.
Now let’s talk more about WP-Cron. Since WP-Cron relies on visitors to your website to trigger tasks, it’s not ideal for time-sensitive jobs, especially if your site has low or inconsistent traffic. That’s where Cloudways gives you a feature called Cron Optimizer, which lets you run WP-Cron jobs reliably on a fixed schedule, regardless of site traffic.
Here’s how to enable Cron Optimizer on Cloudways. Log in to your Cloudways account, click on the Servers tab, select the server where your WordPress app is hosted, click www, then select your application. Go to Application Settings, open the WordPress settings tab, and you’ll see the Cron Optimizer option. Just toggle it on, confirm your selection, and you’re done. Once enabled, WP-Cron jobs will run automatically in the background, even if your site has no visitors.
And that’s a wrap on cron jobs. You’re now ready to automate and manage tasks like a pro. Thanks for watching, and we’ll see you in the next video.
Answer a few questions, and we'll present you with a personalized tour of the Cloudways platform based on your answers.