sumana
2 weeks ago
210
13
Laravel

schedule->command("command:name")->everyFiveMinutes() not calling

Posted 2 weeks ago by sumana

Hi,

I am working on laravel project. I have a task scheduled to run an artisan command, for me cronjob calling every five minutes but it fail to call command.

In kernel.php

protected $commands = [ 'App\Console\Commands\everyMinute' ];

protected function schedule(Schedule $schedule)
{
  
        echo "test\n";
    $schedule->command('minute:update')
              ->everyMinute();
               echo "done\n";
   
}

IN everyMinute.php

protected $signature = 'minute:update';

public function handle() {

     echo "inside every minute function\n";
      $inv_data = Invoice::where('inv_paymentid','I-41MFYFGW1006')->get()->last();
                        $data = array(
                        'inv_file'          => 'Invoice'.'1'
                    );
                        $inv_data->update($data);

}

my cronjob setting

/usr/local/bin/php /home/chiros8/public_html/artisan schedule:run 2>&1 >> /home/chiros8/public_html/cronoutput.log

I am getting output in cronoutput.log

test done

but value not updated and inside the command file echo also not displayed.

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