How to Run Cron Jobs Every 5 Minutes, 10 Minutes, or 15 Minutes

In the fast-paced world of the internet age, everyone knows that efficiency is key. One way for you to increase efficiency is by automating repetitive tasks, especially if you're an overworked or overwhelmed webmaster who simply doesn't have the time or the power to keep up with miniscule tasks when there's other work to be done. Thankfully, this is where a cron job can be a true lifesaver. But how do cron jobs work, and how can you use them to schedule your routine tasks? Read on to learn more.
Table of Contents
Looking for a Cron Job Alternative?
Speak to us to find out how easy to schedule tasks in the cloud with IronWorker with free handeld support.
An Overview of Cron Jobs
Before you go about using cron jobs to schedule your tasks, you should first have an understanding of all the terms you'll need to know in order to run cron jobs. Fortunately, it's nothing too complex. You'll have your cron jobs up and running in no time.
What Is a Cron Job?
Simply put, a cron job is a task that is executed automatically at a certain specified interval. Theoretically, you could schedule a cron job to run every minute, every week, every month, or every year — it's truly up to you and your specific needs. While there's no one designated use for a cron job, they're especially useful when it comes to sending emails, backing up data and databases, checking for available disc space, updating security patches to make sure they're always up to date, and any other task that relates to system maintenance or administrative duties.
What Is a Crontab?
A crontab — also known as a cron table — is the text file that allows you to define the schedule of your cron job. Typically, crontabs are created, viewed, edited, and deleted using the crontab command. Crontabs always have five fields, and each field is always represented by an asterisk. Each one of these fields will determine the date, the time, and the frequency of your repeating cron job.
Your first field will be minutes, and this will be how you determine the minute of the hour your cronjob will be running on. Possible inputs range from 0 to 59. Your second field is for the hour your cronjob will run, with possible inputs ranging from 0 to 23. The third is for day of the month, ranging from 1 to 31. Fourth is month, ranging from 1 to 12. Last is day of the week, ranging from 0 to 7.
Additionally, you need to be familiar with the variety of characters present in each crontab file.
- An asterisk (*) in any of the five fields will mean all allowed values. For example, an asterisk in the minute field will make the cron job repeat every minute.
- A comma (,) will allow you to list values in repetition within a single field. For example, listing2,4,6 in the hour field will make the cron job repeat at 2, 4, and 6 a.m.
- Hyphens (-) are best used when you need to input a range into a field. For instance, 0-3 in the day field would have your task running from Sunday to Wednesday.
- A slash (/) serves a similar purpose to commas and hyphens by allowing you to indicate step values within a range. 0-6/2is the same as saying 0,2,4,6, while */5would mean every 5 minutes, hours, days, etc.
- The letter L indicates Last and can be used to indicate the last day of the month. For example, 1L would mean the last Monday.
- The letter W, similar to the letter L, can be used to indicate the closest weekday to a specific time. This is useful when something needs to be done on the 1st of each month, but the first falls on a weekend — 1Wwould mean that the task would wait until Monday to run.
- The hash symbol (#) is for determining a particular day of the week, like the third Friday of the month (3#5) or the first Monday (1#1).
- The question mark (?) is for when you need to leave a space blank.
Replace Your Cron Jobs With IronWorker
The scheduling capability within IronWorker is simple to use and offers greater reliability than cron jobs. Schedule your tasks for specific times, set a frequency/delay timer for task repetition, or enable tasks to be process on demand.
Every 5 Minutes
You actually have a couple of different ways you could run a cron job every five minutes: With commas or with an asterisk and a slash. Whether you prefer to write out 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 or simply */5, either option will allow you to run your cron job every five minutes.
Every 10 Minutes
The same goes for every 10 minutes. You could either write out 0, 10, 20, 30, 40, 50, or you could write */10. Of course, it needs to be said that the former option leaves a lot more room for error than the latter (not to mention, it's much more time-consuming). You are probably better off sticking with the asterisk and slash, but it's really up to you.
Every 15 Minutes
If you've got the hang of things by now, then you know that you can run a cron job every 15 minutes by writing out 0, 15, 30, 45 or simply */15 in the crontab space for minutes.

Conclusion
While the process of setting up a cron job might have sounded difficult or intimidating at first, our hope is that you know have a firm grasp on cron jobs and can begin using them to create a more efficient work environment almost immediately. However, running your cron jobs in the cloud is problem for developers. Learn more about IronWorker and it's ability to run tasks in the cloud.
Schedule Cron Jobs In The Cloud
With IronWorker, you can schedule your tasks for specific times, set a frequency/delay timer for task repetition, or enable tasks to be process on demand.