When I’m developing on my local machine (OSX Mac) I sometimes need to see how the scheduler is going to interact with my application. Perhaps running some garbage collection or sending notifications etc.
Until now I’ve had to manually sit running
php artisan schedule:run myself which is not what I signed up for when I started coding!!
I was looking around once again for an answer and came across this gem in the comments of a closed Laravel issue.
php artisan schedule:run
echo "Sleeping 60 seconds..."
Simply navigate to the root of your project, run this command in a terminal window followed by typing scheduler and TA DA! 1 minute schedule loops :). Big hat tip to Oliver Kaufmann for this one!
Also if you need to test things quickly then change the sleep 60 to a lower number, just make sure you don’t upset any downstream APIs by calling them too often.
Leave a Reply