php artisan make:console RefreshToken
建立app/Console/Commands 下建立RefreshToken.phpphp
protected $signature = 'refreshToken';
protected $description = 'Refresh Api Token';
public function handle() { Log::info('Token Refreshed'); }
//Commands\Inspire::class, Commands\RefreshToken::class, ]; protected function schedule(Schedule $schedule) { $schedule->command('refreshToken') ->everyMinute(); }
文件內容:app
* * * * * php /home/w/code/BTLIS/artisan schedule:run >> /dev/null 2>&1
在終端中項目目錄下(Linux 環境)
告訴crontab 文件名: spa
crontab cron.txt
開始定時任務code
crontab -l
或許以後你要結束任務 blog
crontab -r