I have a Laravel 5 task which I am scheduling to run between a specified time range every day:
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
$pending_bookings = Booking::draft()->get();
foreach($pending_bookings as $booking) {
if(!$booking) abort(404);
$booking->notify(new sendReminder($booking));
}
})->daily()->timezone('Europe/London')->between('14:00', '15:00');
}
This does not work, however if I change it to run every minute using everyMinute();
then it does run successfully:
$schedule->call(function () {
// send reminder SMS for all pending bookings
$pending_bookings = Booking::draft()->get();
foreach($pending_bookings as $booking) {
if(!$booking) abort(404);
$booking->notify(new sendReminder($booking));
}
})->everyMinute();
My CRON on the server is set to run every half an hour as it's a shared hosting so it can't run for less than half an hour:
0,30 * * * * /usr/local/bin/php -q /home/username/public_html/bookings/artisan schedule:run >> /dev/null 2>&1
Anyone know why the first cron job: daily()->timezone('Europe/London')->between('14:00', '15:00');
is not running?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire