Search code examples
cron

run cron job every minute between 7AM and 12AM


I am attempting to run a cron job every minute between 7AM and 12PM the expression I am attempting to use is as follows:

*/1 7-24 * * *

which doesn't appear to run correctly. I am fairly new to writing such expressions, could anyone point me in the right direction for what I am trying to achieve


Solution

  • If you mean every minute between 7:00 and 12:00 (12pm, noon), use this:

    * 7-12 * * *
    

    If you want every minute between 7:00 and 24:00 (12am, midnight), use this:

    * 7 * * *
    

    Other combinations you can try here: crontab guru

    First star already means every minute, so there is no need to manipulate this further.