crontab -e
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Step2 : Modify Kernel.php
class Kernel extends ConsoleKernel
{
...
protected function schedule (Schedule $ schedule )
{
// example command
$ schedule ->command ('demo:cron ' )->dailyAt ('10:00 ' )->timezone ('Europe/Paris ' );
// example exec
$ schedule ->exec ('/usr/local/bin/node ' . storage_path ('scripts/test/ ' ) .'main.js ' )->everyMinute ();
}
....
}
php artisan schedule:run
php artisan schedule:list
Register as Task Scheduler
Command
Description
everyMinute();
Run the task every minute
everyFiveMinutes();
Run the task every five minutes
everyTenMinutes();
Run the task every ten minutes
everyFifteenMinutes();
Run the task every fifteen minutes
everyThirtyMinutes();
Run the task every thirty minutes
hourly();
Run the task every hour
hourlyAt(17);
Run the task every hour at 17 mins past the hour
daily();
Run the task every day at midnight
dailyAt(’13:00′);
Run the task every day at 13:00
twiceDaily(1, 13);
Run the task daily at 1:00 & 13:00
weekly();
Run the task every week
weeklyOn(1, ‘8:00’);
Run the task every week on Tuesday at 8:00
monthly();
Run the task every month
monthlyOn(4, ’15:00′);
Run the task every month on the 4th at 15:00
quarterly();
Run the task every quarter
yearly();
Run the task every year
timezone(‘America/New_York’);
Set the timezone