In my kernel.php schedule() in Laravel 8, I have this line.
$schedule->command('exec "cat /var/log/nginx/access.log | grep -v -e "download" -e "danger" -e "/visitor/return" -e "welcome" -e "GET / HTTP" -e "/baby/" -e "/paste/" | awk "{ print $1, $4, $7 }"')->daily()->emailOutputTo($email)->environments('prod');
If I need to test it and need to run right now, what command do I need to run ?
I've tried this at the root of the project
php artisan schedule:run >> /dev/null 2>&1
Nothing seems to work, I just don't want to wait for a day to see the result.
You can do that using the tinker console (php artisan tinker). The following happens inside tinker.
Get the schedule instance from the container
Get the scheduled event (note that I have not added the daily())
Run the event, supplying the container as a parameter - you could chain this run call above as well, obviously.