3

I am new in laravel and i tried to set task scheduler using cpanel cronjob. But cronjob not working.

php /home/webservername/public_html/demo/projectname/artisan schedule:run 1>> /dev/null 2>&1

My kernel code :

protected $commands = [
    Commands\HourlyUpdate::class,
];

protected function schedule(Schedule $schedule)
{
    $schedule->command('hour:update')
              ->everyMinute();
    $schedule->call(function () {
                  DB::table('test')->insert(
                    ['title' => 'test', 'datetime' => '2018-07-10 14:38:00']
                    );
                })->everyMinute();
}

When i run project in my localhost, try using command prompt its working.

php artisan schedule:run
abdul kadhar
  • 337
  • 4
  • 20

1 Answers1

2

For anyone that comes across this, I had a similar issue and the following command worked for cronjob on cpanel (for Laravel task scheduling) :

/usr/local/bin/php /home/webservername/projectname/artisan schedule:run >> /dev/null 2>&1
Courtney White
  • 612
  • 8
  • 22