7

I have cron with following definition.

*/5 * * * * /somescript

What is the difference between them? Is second one running every 5 minutes and first is running 5 minutes after every hour?

Dave M
  • 4,514
  • 22
  • 31
  • 30
pregmatch
  • 303
  • 1
  • 5
  • 14

1 Answers1

13

5 * * * * means it runs once per hour at five minutes past the hour.

*/5 * * * * means it runs once every five minutes.

The later construct behaves slightly unintuitive if the number does not divide 60. For example */19 would run 4 times per hour at :00, :19, :38, and :57.

kasperd
  • 30,455
  • 17
  • 76
  • 124
  • 5
    You can also replace the `*` with e.g. 2-59/19 which means run at :02, :21, :40, and :59. – wurtel Aug 17 '17 at 10:03