Task scheduler works on homestead, but not on shared hosting

Posted 11 months ago by patrikw1

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?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.