2

My schedular is not calling automatically after every minute.

I have tried following code

protected function schedule(Schedule $schedule)
{
   $schedule->command('timestamp:minute')->everyMinute();
}

I need that my schedular will call automatically.

Chin Leung
  • 14,621
  • 3
  • 34
  • 58
Jainam Shah
  • 204
  • 1
  • 9
  • 3
    Did you setup the cron job on your machine? `* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1` – Chin Leung Jun 04 '19 at 12:10
  • I am new to it, can you please elaborate, how to setup i.e where to write the above line mentioned by you – Jainam Shah Jun 04 '19 at 12:46
  • You can try this https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job – Chin Leung Jun 04 '19 at 12:47
  • Possible duplicate of [How to run schedule tasks every minute in Laravel?](https://stackoverflow.com/questions/56429636/how-to-run-schedule-tasks-every-minute-in-laravel) – thisiskelvin Jun 04 '19 at 13:14

1 Answers1

2

in your terminal, type crontab -e and add below line at the end

* * * * * /usr/bin/php{php_version} /path_to_project/artisan schedule:run >> /dev/null 2>&1

Now, in terminal, go to your project directory and run once

php artisan schedule:run
SenilShah
  • 146
  • 3