I used cron expressions cron('*/3 * * * *')
and it means every 3 minute, but now I need in every 30 seconds. BUT I read that cron does not have anything for using seconds, also someone offered just repeat it 2 times with sleeping, but I guess it is just a crutch. And I tried to do something like that cron(3 * * * * *)
but Laravel throw exception, that it is impossible.
Asked
Active
Viewed 141 times
-1

Aleks
- 147
- 10
-
2Does this answer your question? [Running a cron every 30 seconds](https://stackoverflow.com/questions/9619362/running-a-cron-every-30-seconds) – miken32 Mar 10 '21 at 19:28
1 Answers
0
You can't. Cron has a 60 sec granularity. Not a Laravel problem.
If you are running a recent Linux OS with SystemD, you can use the SystemD Timer unit to run your script at any granularity level you wish (theoretically down to nanoseconds), and - if you wish - much more flexible launching rules than Cron ever allowed. No sleep kludges required

MrEduar
- 1,784
- 10
- 22