$schedule->call(function ()
{
error_log("Line Schedule 1:Start");
//Send Email
error_log("Line Schedule 1:End");
})->everyFiveMinutes()->name('event_name:1')->withoutOverlapping();
$schedule->call(function ()
{
error_log("Line Schedule 2:Start");
//Send Email
error_log("Line Schedule 2:End");
})->everyFiveMinutes()->name('event_name:2')->withoutOverlapping();
$schedule->call(function ()
{
error_log("Line Schedule 3:Start");
//Send Email
error_log("Line Schedule 3:End");
})->everyFiveMinutes()->name('event_name:3')->withoutOverlapping();
i run these schulders using command php artisan schedule:run and i am running many instances in parallel. and my logs file says that schulder 2 is starting second time even its previous instance has not completed it yet .
[01-Jan-2016 11:30:08 UTC] Line Schedule 1:Start
[01-Jan-2016 11:30:11 UTC] Line Schedule 2:Start
[01-Jan-2016 11:30:13 UTC] Line Schedule 3:Start
[01-Jan-2016 11:30:15 UTC] Line Schedule 1:End
[01-Jan-2016 11:30:15 UTC] Line Schedule 2:Start
[01-Jan-2016 11:30:17 UTC] Line Schedule 2:End
[01-Jan-2016 11:30:17 UTC] Line Schedule 3:Start
[01-Jan-2016 11:30:19 UTC] Line Schedule 3:End
[01-Jan-2016 11:30:21 UTC] Line Schedule 2:End
[01-Jan-2016 11:30:21 UTC] Line Schedule 3:Start
[01-Jan-2016 11:30:22 UTC] Line Schedule 3:End
[01-Jan-2016 11:30:25 UTC] Line Schedule 3:End
Just name your task with a call to name() and chain the methods that define when your task should be run.
$schedule->call(function () {
//Some Code
})->everyFiveMinutes()
->name('some_name')
->withoutOverlapping();
For anonymous functions the name is required to prevent overlapping.