How to run crontab job every minute on a Linux or Unix-like system

Posted on in Categories , , last updated May 3, 2017

I‘m using a CentOS Linux server. How do I run a cron job every minute? How can I use crontab to execute script or shell command every minute?

The basic syntax is as follows to run crontab job every minute:

* * * * * /path/to/script

OR

* * * * * /path/to/command

OR run script:

* * * * * /scripts/lxc/update www1 db1 memecache1

OR ping our nas server every minute:

* * * * * /sbin/ping -q -c 4 nas01.cyberciti.biz >/dev/null

The crontab file syntax is as follows:

* * * * * /command/to/be/executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

The asterisk (*) operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month. In this specific examples, an asterisk in all fields means run job every minute. See our cron jobs tutorials for more information.

This entry is 12 of 15 in the Linux Cron Jobs Howto & Tutorial series. Keep reading the rest of the series:
  1. What is cron on a Linux or Unix-like systems?
  2. HowTo: Add Jobs To cron Under Linux or UNIX?
  3. Linux Verify crond Daemon And Cronjobs Are Running
  4. Linux Start Restart and Stop The Cron or Crond Service
  5. Linux: List / Display All Cron Jobs
  6. Linux / UNIX Crontab File Location
  7. Linux / UNIX: Change Crontab Email Settings ( MAILTO )
  8. Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems
  9. Linux: At What Time Cron Entries In cron.daily, cron.weekly, cron.monthly Run?
  10. Linux Execute Cron Job After System Reboot
  11. Linux / UNIX Setup and Run PHP Script As A Cron Job
  12. How to run crontab job every minute on a Linux or Unix-like system
  13. Run crontab (cron jobs) Every 10 Minutes
  14. Cron Job Script Execution on the Last Day of a Month
  15. Run crontab (cron jobs) every 1 minute

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Leave a Comment