Thursday, February 8, 2024

[SOLVED] laravel run command / cron every 7 seconds on sunday

Issue

So i would like to accomplish the a command which runs every sunday but also every 7 seconds on that sunday.

The following is from the docs but I don't have an idea on how to achieve this. Anyone able to direct me in the right direction?

protected function schedule(Schedule $schedule)
{
    $schedule->command('test:cron')
             ->everyMinute();
}

Solution

This will run the command sunday every minute:

protected function schedule(Schedule $schedule)
{
    $schedule->command('test:cron')->cron('* * * * SUN');
}

Check it here

PS: I don't think you can use cron to go lower than "every minute".



Answered By - cdruc
Answer Checked By - Cary Denson (WPSolving Admin)