Running A Cron Job At A Time Every Hour/Minutes/Second/Day
Today in this article, we will see a few examples of Running A Cron Job At A Time Every Hour/Minute/Second/Day.
Updated October 2026: corrected crontab examples and field ranges, a section on sub-minute jobs, a section on wrong-time pitfalls, and an FAQ.
Overall we will see examples in this article,
- Running a Cron Running a cron job at 2:30 AM every day
- Example – Cron every day on a given time
- How to run a cron job every week on Sunday at 1.30 am
- Example 2 – Cron every week on a particular day and time
- How to run crontab job every hour
- Example 3 – Cron every hour
- How to run crontab job every 30 minutes
- Example 4
The naming common Pattern for Cron Jobs is as below,
* * * * *

@1 – This indicates the time in minutes varies between 0 to 59 minutes (0 – 59). Anything above this, please use 2nd *parameters which lets you add hours-wise details.
@2 – This indicates the time in hours varies between 0 to 23 hours (0 – 23). Anything above this, please use 3rd *parameters which lets you add day-wise details.
@3 – This indicates the time in a day varies between 1 to 31 days of the month (1 – 31). Anything above this, please use 4th *parameters which lets you add month-wise details.
@4– This indicates the month varies between 1 to 12 months of the year (1 – 12). Values above 12 are invalid. For longer gaps, use a step or a list in this field.
@5 – This indicates the day of the week varies between 0 to 6 of a week. (0 – 7) (Sunday=0 or 7)
Here
- 0 = Sunday
- 1 = Monday
- 2 = Tuesday
- 3 = Wednesday
- 4 = Thursday
- 5 = Friday
- 6 = Saturday
+---------------- minute (0 - 59) | +------------- hour (0 - 23) | | +---------- day of month (1 - 31) | | | +------- month (1 - 12) | | | | +---- day of week (0 - 6) (Sunday=0 or 7) | | | | | * * * * * command to be executed
Running a Cron Running a cron job at 2:30 AM every day
Example – Cron every day on a given time
Cron job run at 2:30 AM every day
30 2 * * *
How to run a cron job every week on Sunday at 1.30 am
Example 2 – Cron every week on a particular day and time
Run a cron job every week on Sunday at 1.30 am
30 1 * * 0
How to run crontab job every hour
Below examples show running Crontab job every 3 hour
Example 3 – Cron every hour
* 3 * * *
below examples show running the Crontab job every hour
0 * * * *
How to run crontab job every 30 minutes
Example 4
How to run crontab job every 30 minutes
0,30 * * * *
Other References :
Do you have any comments or ideas or any better suggestions to share?
Please sound off your comments below.
Happy Coding !!
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published (2026) best practices and guidelines for software design and development.
Can Cron Run a Job Every Second or Every 10 Seconds?
No. Standard five-field Unix cron has no seconds field, and the cron daemon checks its entries once a minute, so one minute is the smallest interval you can schedule directly. You can fake shorter intervals, but each option has a cost.
How do you fake every 10 seconds with cron?
Add six every-minute entries (* * * * *) that all run the same command. The first has no delay. The other five are prefixed with sleep 10, sleep 20, sleep 30, sleep 40 and sleep 50, each followed by && and the command.
Cron forks all six at :00, so you get six processes a minute that mostly wait. The commands are spread across the minute, but the process spike still lands at the top of it.
How do you stop slow runs from piling up?
Wrap the command in flock -n with a lock file. If the previous run still holds the lock, the new run exits immediately instead of stacking up. A timeout shorter than the interval also works, because it kills a run before the next one starts.
In plain English: A lock works like the lock on a single-person restroom. If someone is inside, you walk away instead of queuing. The analogy stops fitting in one way:
flock -nskips the run entirely and doesn’t wait for a turn.
Use the same protection on ordinary every-minute jobs. Any job that can run longer than its schedule gap can overlap with itself.
What are the alternatives to cron for sub-minute jobs?
A systemd timer handles seconds natively. Set OnCalendar=*-*-* *:*:00/10 to fire every 10 seconds. Also set AccuracySec=1s, because the default accuracy is one minute and lets systemd coalesce runs, which defeats the schedule.
On macOS, cron is still supported, but its functionality has been absorbed into launchd. Launchd is the more flexible choice there.
Why does a six-field expression fail in my crontab?
Spring @Scheduled and Quartz-style schedulers use six fields with seconds first. In those tools, */10 * * * * * means every 10 seconds. In a normal crontab it is not valid, because cron expects five time fields and would treat the extra field as part of the command.
Check which dialect your tool uses before you copy an expression from a Stack Overflow answer or a framework doc.
Frequently asked questions
How do I run a cron job every hour at a specific minute, such as 30 past?
Use 30 * * * * to run at 30 minutes past every hour. The minute field sets the cadence: a wildcard gives 60 runs an hour, while a fixed value gives one. For comparison, 0 * * * * runs at the top of the hour, which is 24 runs a day.
What’s the difference between 0 * * * * and */60 * * * *?
Use 0 * * * *, because it’s the portable way to say hourly. */60 in the minute field is invalid in some parsers, since the step can’t equal the size of the field’s range (0 to 59 is 60 values). Even where it’s accepted, it gains you nothing over 0 * * * *.
How do I run a cron job every 2 hours?
Use 0 */2 * * *. A step works after an asterisk or a range, so 0 0-23/2 * * * is the same schedule written with an explicit range. The V7-standard alternative is a comma list of hours. Always pin the minute to 0, otherwise the job runs every minute of the matching hours.
What does */5 mean in a crontab?
The slash is a step value: */5 in the minute field means every 5 minutes (0, 5, 10 … 55), so */5 * * * * runs every 5 minutes. The step counts from the start of the field’s range and restarts each hour. That’s why steps that divide the range evenly, such as 5, 10, 15 or 30, give a steady rhythm, while a step like 7 does not.
