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

Written by Diana Bocco Fact-checked by Alex Ioannides
1,353 words | 7 min read
Last updated on: November 27, 2025

When it comes to website maintenance and automation, scheduling tasks to run at specific intervals is both helpful and convenient.

Whether it’s updating content, sending emails, or performing system checks, cron jobs offer a reliable solution that saves you time and effort.

Image
Downtime happens. Get notified!
Join the world's leading uptime monitoring service with 2.1M+ happy users.

In this guide, we’ll walk you through setting up cron jobs to run at intervals of 5, 10, 15, or 30 minutes.

What is a cron job?

A cron job is a scheduled task that runs automatically at predefined intervals on Unix-like operating systems.

It allows you to automate repetitive tasks without manual intervention, making it an essential tool for system administrators, developers, and website owners.

With cron jobs, you can execute scripts, commands, or programs at regular intervals, ensuring timely execution of critical tasks.

What is a crontab?

Simply put, a crontab is a file used to configure cron jobs. It contains a list of cron jobs, each specifying a command or script to run and the schedule at which it should execute.

The crontab format consists of five fields representing the minute, hour, day of the month, month, and day of the week, followed by the command to be executed.

Crontab allows for precise scheduling of tasks, including running them every minute, every hour, or at custom intervals like every 5, 10, 15, or 30 minutes.

For more in depth information on the ins and outs of these handy bits of code, check out our ultimate cron job guide.

Understanding the crontab format

Before creating cron expressions like every 5, 10, 15, or 30 minutes, it helps to understand how the crontab format works. A crontab line contains five time fields followed by the command you want to run.

*  *  *  *  *  /path/to/your/command
|  |  |  |  |
|  |  |  |  ----- Day of the week (0 to 7)
|  |  |  -------- Month (1 to 12)
|  |  ----------- Day of the month (1 to 31)
|  -------------- Hour (0 to 23)
----------------- Minute (0 to 59)

Each asterisk represents a time value. You can replace these with numbers, ranges, lists, or step values to create a schedule.
For example, the step value */5 means “every 5 minutes.”

This format allows precise scheduling for anything from simple recurring tasks to complex automation workflows.

How to run cron jobs

Every 5 Minutes

Running a cron job every 5 minutes is a common requirement for tasks that require frequent updates or checks. Such tasks could include checking for emails or notifications, monitoring system logs for errors or warnings, clearing temporary files, and much more.

To schedule a cron job to run every 5 minutes, enter this code:

*/5 * * * * /path/to/your/command

This cron expression translates to “run the command every minute that is divisible by 5.” It’s a simple and effective way to make sure your task runs at 5-minute intervals without fail.

Alternative expressions for this interval

You can also write the same schedule using step ranges:

0-59/5 * * * *

Or list out specific minutes manually:

0,5,10,15,20,25,30,35,40,45,50,55 * * * *

All three options run your task every 5 minutes.

Every 10 Minutes

If you need a cron job to run every 10 minutes, you can use the following crontab entry:

*/10 * * * * /path/to/your/command

This cron expression instructs the system to run the specified command every 10 minutes, providing regular updates or executing tasks at consistent intervals.

Alternative expressions for this interval

You can also write the same schedule using step ranges:

0-59/10 * * * *

Or list out specific minutes manually:

0,10,20,30,40,50 * * * *

All three options run your task every 10 minutes.

Every 15 Minutes

To schedule a cron job to run every 15 minutes, enter this crontab entry:

*/15 * * * * /path/to/your/command

This cron expression ensures that your task is executed every 15 minutes, allowing for timely updates or maintenance activities on your system.

Alternative expressions for this interval

You can also write the same schedule using step ranges:

0-59/15 * * * *

Or list out specific minutes manually:

0,15,30,45 * * * *

All three options run your task every 15 minutes.

Every 30 Minutes

For tasks that require less frequent execution, you can schedule a cron job to run every 30 minutes using the following entry:

*/30 * * * * /path/to/your/command

This cron expression specifies that the command should be executed every 30 minutes, providing ample time for tasks to be completed between each run.

Alternative expressions for this interval

You can also write the same schedule using step ranges:

0-59/30 * * * *

Or list out specific minutes manually:

0,30 * * * *

All three options run your task every 30 minutes.

More useful cron timing examples

Cron offers more flexibility than simple step values. Here are additional examples that help you schedule tasks more precisely.

Run every 5 minutes starting at minute 2

2-59/5 * * * * /path/to/your/command

This means the task runs at 02, 07, 12, 17, 22, and so on.

Run every 10 minutes during working hours only

*/10 8-18 * * * /path/to/your/command

This runs the task from 08:00 to 18:59 every day.

Run every 15 minutes on weekdays

*/15 * * * 1-5 /path/to/your/command

This runs on Monday through Friday only.

Run every 30 minutes at night

*/30 0-6 * * * /path/to/your/command

This is useful for nightly maintenance tasks.

These patterns give you more control and help avoid running tasks when they are not needed.

Practical examples of cron jobs

Here are common tasks that benefit from running on predictable intervals:

Regular cleanup

*/30 * * * * rm -rf /tmp/*

Rotating logs

*/15 * * * * /usr/sbin/logrotate /etc/logrotate.conf

Running backups

*/10 * * * * /usr/local/bin/backup.sh

Running monitoring checks

*/5 * * * * curl -fsS https://example.com/healthcheck

These examples help you understand how cron expressions are used in real maintenance workflows.

How to prevent duplicate cron jobs from running?

Preventing duplicate cron jobs from running is essential to avoid unnecessary system load and potential conflicts.

Here are some strategies to ensure that only one instance of a cron job is running at a time:

  • Use a locking mechanism: Implement a locking mechanism within your script to prevent multiple instances from running simultaneously. This can be achieved by creating a lock file or using a process management tool like flock.
  • Check for running processes: Before executing the main task of your cron job, check if any previous instances are still running. You can use commands like pgrep or ps to identify existing processes and terminate them if necessary.
  • Set a unique identifier: Include a unique identifier or timestamp in your cron job’s output or log files. This allows you to track when the cron job was last executed and determine if another instance is currently running.
  • Adjust cron scheduling: Review your cron job schedule to be sure that the interval between executions is sufficient to complete the task. If necessary, adjust the scheduling to avoid overlapping instances.

Using these strategies, you can effectively prevent duplicate cron jobs from running and maintain the stability and efficiency of your system.

Troubleshooting common cron job issues

Even a simple cron expression may not run as expected. Here are common problems and how to fix them.

The cron job never runs

Check that the cron service is running:

sudo service cron status

The command works manually but not in cron

Cron uses a limited environment. Add full paths:

*/5 * * * * /usr/bin/php /var/www/site/script.php

Missing environment variables

Add them directly inside your crontab:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

No logs from cron

Check system logs:

grep CRON /var/log/syslog

Wrong user crontab

Make sure you are editing the correct user:

crontab -e
sudo crontab -e

These quick checks fix most cron job issues.

Image
Downtime happens. Get notified!
Join the world's leading uptime monitoring service with 2.1M+ happy users.

Conclusion

Cron jobs are one of the simplest and most reliable ways to automate tasks on any Unix based system. Once you understand how the crontab format works, scheduling commands at intervals such as every 5, 10, 15, or 30 minutes becomes straightforward. These expressions help you keep your system clean, automate maintenance, update services, and run monitoring tasks without manual work.

By combining step values, ranges, and time restrictions, you can fine tune your schedules to match exactly when your tasks need to run. Adding checks to prevent duplicate executions ensures your jobs stay efficient and avoid conflicts. With the right structure in place, cron becomes a dependable automation tool that supports both small scripts and critical production processes.

If you want to make sure your scheduled tasks are running smoothly, consider pairing your cron jobs with uptime and performance monitoring. A reliable monitoring tool will alert you the moment something fails, helping you fix issues before they become problems.

FAQ's

  • Yes. The step syntax is supported on all modern Linux distributions.

  • Cron uses the server’s local time unless configured otherwise.

  • No, cron’s smallest unit is one minute.

  • Run the command manually or trigger cron logs with:

    sudo grep CRON /var/log/syslog
  • User crontabs are stored in /var/spool/cron/crontabs.

  • Yes. For example:

    0,30 8-18/2 * * * /path/to/command
Diana Bocco

Written by

Diana Bocco

Copywriter |

Diana Bocco combines her expertise to offer in-depth perspectives on uptime monitoring and website performance. Her articles are grounded in practical experience and a deep understanding of how robust monitoring can drive business success online. Diana's commitment to explaining complex technical concepts in accessible language has made her a favorite among readers seeking reliable uptime solutions.

Expert on: DevOps, Monitoring

🎖️

Our content is peer-reviewed by our expert team to maximize accuracy and prevent miss-information.

Alex Ioannides

Content verified by

Alex Ioannides

Head of DevOps |

Prior to his tenure at itrinity, Alex founded FocusNet Group and served as its CTO. The company specializes in providing managed web hosting services for a wide spectrum of high-traffic websites and applications. One of Alex's notable contributions to the open-source community is his involvement as an early founder of HestiaCP, an open-source Linux Web Server Control Panel. At the core of Alex's work lies his passion for Infrastructure as Code. He firmly believes in the principles of GitOps and lives by the mantra of "automate everything". This approach has consistently proven effective in enhancing the efficiency and reliability of the systems he manages. Beyond his professional endeavors, Alex has a broad range of interests. He enjoys traveling, is a football enthusiast, and maintains an active interest in politics.

Recent Articles