@patrikw1 may a typo in crontab? try sending an email to yourself in one of these commands
Task scheduler works on homestead, but not on shared hosting
Hi, i have following methods in Kernel class:
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//restarts queue worker, preventing memory stuck
$schedule->command('queue:restart')
->everyMinute()
->name('restarts queue worker');
//Each Video total_video_views will be accurately updated for example on daily basis.
$schedule->command('video:update-views')
->everyMinute()
->between('9:00', '23:00')
->name('updates all video views');
//Page Insights will be updated
$schedule->call(function () {
$this->app->queue->push(new UpdatePageInsights);
})
->everyMinute()
->name('page insights');
//this is alternative to supervisor since shared hosting someties doesnt provide supervisor
//so we use cron instead to keep queue worker up
$schedule->command('queue:work --queue=high,default --memory=1024')
->everyMinute()
->name('keeps queue worker active')
->withoutOverlapping();
}
i run cron as: php web/artisan schedule:run
without & mark etc. When i set cron on the server and tell cron to mail me the output of the cron, i get excepted output with all those names i set on scheduled tasks..
However, none of these command get executed, i have no output in my lumen.log as i expected, and no new jobs in the database queue..
When i log on the server via SSH, and type php artisan schedule:run, it works, Lumen.log is filled with information and queue jobs are pushed to the default queue, and being processed.
Another strange thing is that, when i remove cron job from server, queue worker keeps processing jobs.. even though queue:work command is not executed by task scheduler anymore
Please can somebody explain me how is this possible?
This is fixed now, hosting provider informed me that my cron got stuck and therefore he had to kill it..
The second issue was that i have to use queue:listen now instead of queue:work, since queue worker doesn't execute handle() method in my job.
Please or to participate in this conversation.