Search code examples
phpcroncron-task

Cronjob every x minutes from 9 to 23 hours


I need to configure cronjob at specific time, like every 50 minutes from 9 to 23 pm. And I am trying

  • */50 9-23 ***

But it runs at 9:50 and also at 10:00, I need some help. Thanks.


Solution

  • The time range you define it is converted into:

    9 50
    10 40
    11 30
    12 20
    13 10
    14 00
    15 50 -
    16 40
    17 30
    18 20
    19 10
    20 00
    20 50 -
    21 40
    22 30
    

    So that you need to define these different cronjobs:

    50 9,15,20 * * *
    40 10,16,21 * * *
    30 11,17,22 * * *
    20 12,18 * * *
    10 13,19 * * *
    00 14,20 * * *