简体   繁体   中英

Laravel Scheduled Command doesn't run

Using Laravel, I have a cron in Kernel.php that doesn't seem to run when just left to run, if I run php artisan command-name manually, it does work. Below is what I have in Kernel.php , I'm not sure what's stopping it running every 5 minutes, automatically:

$schedule->command('command-name')
->everyFiveMinutes()
->withoutOverlapping()
->runInBackground()
->sendOutputTo(storage_path('logs/command-name.log'));

withoutOverlapping should create a file in storage folder with a name as

schedule_123456....

If the command stopped abruptly this file could remain undeleted. I think you have to delete it manually.

Two things:

  1. withoutOverlapping create a lock for 24 hours that avoids to run a new instance of same, while runInBackground let more than one instance to run concurrently. I'ld use only one of the two options..
  2. you can pass a parameter to withoutOverlapping to let the check to last less than 24 hours

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM