以下のように、Kernel.phpで1時間ごとに3つのスケジュールジョブがあります。
$schedule->command('get:twitter')->cron('* 1 * * * *');
$schedule->command('get:facebook')->cron('* 1 * * * *');
$schedule->command('get:googleplus')->cron('* 1 * * * *');
この3つのスケジュールを、次のような時間間隔で実行したいと思います。
$schedule->command('get:twitter')->cron('* 1 * * * *');//after 1 hour
$schedule->command('get:facebook')->cron('30 1 * * * *');//after 1.30 hour
$schedule->command('get:googleplus')->cron('45 1 * * * *');//after 1.45 hour
これはlaravel5.1で可能ですか?
箱から出してすぐに使えるものはありませんが、次のようなことができます。
// every hour
$schedule->command('get:twitter')->hourly();
// every one and a half hours
$schedule->command('get:facebook')->cron('0 0,3,6,9,12,15,18,21 * * * *');
$schedule->command('get:facebook')->cron('30 1,4,7,10,13,16,19,22 * * * *');
// every two hours at x.15 minutes (0.15, 2.15, 4.15 etc)
$schedule->command('get:googleplus')->cron('15 */2 * * * *');
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加