Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel scheduler run twiceDaily at specific hours

How can I run Laravel scheduler twice daily at specific hours? Let's say I want my command to run every day at 9am and 5pm

There is an option to use twiceDaily, but I'm not sure how to specify hours

like image 653
George Sharvadze Avatar asked May 28 '15 10:05

George Sharvadze


People also ask

How do I run Task Scheduler every 2 hours?

We go to the 'Triggers' tab and select the 'Edit' option: An 'Edit Trigger' screen will appear. To set the script to run hourly, we select the 'Repeat task…' option and enable it.


1 Answers

You can use manual cron expression:

$schedule->command('foo')->cron('0 9,17 * * *');

Read more: http://laravel.com/docs/5.0/artisan#scheduling-artisan-commands


If you're not familiar with cron expressions, here's the nice GUI: http://cron.nmonitoring.com/cron-generator.html

like image 69
Limon Monte Avatar answered Oct 09 '22 13:10

Limon Monte