Mehedi Hasan Siam
Mehedi Hasan Siam

Reputation: 1272

How to run a cron jobs in every minute for a specific hour on server

Here I am trying to run a php file through cron job process. I want to run that php file For every minute from 4PM to 5PM. I have tried both

*   16-17   *   *   *   

And

*   16,17   *   *   *   

But It's not working. How should I write the exact command to run this?

Upvotes: 1

Views: 184

Answers (1)

Harry B
Harry B

Reputation: 2971

To include multiple specific values in a cron job you separate them with commas.

For 16-17 you want 16,17 so you get:

# m |  h  | d | m | Day of week
  *  16,17  *   *   *

# All the below can include multiple values using commas
# m = minute (minute from 0 to 59)
# h = hour (hour of the day, from 0 to 23)
# d = day (day of month, from 1 to 31)
# m = month (month of the year, where 1 is January)
# dow = day of the week (0-7 where 0 and 7 are Sunday)

Upvotes: 1

Related Questions