*/5
means "any minute, but every 5".
Depending on the implementation, this is enough
*/5 5-20 * * * php ~/pasta/para/app/artisan queue:work
crontab Syntax:
* * * * * caminho/comando
│ │ │ │ │
│ │ │ │ └────── em quais dias da semana de 0 a 7 (tanto 0 quanto 7 são Domingo)
│ │ │ └────────── em quais meses (1 - 12)
│ │ └────────────── em quais dias (1 - 31)
│ └────────────────── em quais horas (0 - 23)
└────────────────────── em quais minutos (0 - 59)
Specifying each item:
* Todos
1,2,4 Um, dois e Quatro apenas
7-10 De 7 a 10, incluindo 8 e 9
*/5 A qualquer momento, mas com espaço de 5 (ex: 2,7,12,17...)
1-10/3 No intervalo de 1 a 10, mas de 3 em 3 (ex: 2,5,8)
Note: When you use /n
, it depends on when cron
is updated by the table the range is counted, so */5
can be either 0.5, 10.15 as 1.6.111.16.
An example would need to be every 3 hours in that range:
*/5 5-20/3 * * * php ~/pasta/para/app/artisan queue:work
Note: cron
has no breaks in some implementations (I'm not sure if this is in some modern distro yet), you may need to specify all the times:
*/5 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 * * * php ~/pasta/para/app/artisan queue:work
More details in the crontab
manual:
link