I've set up the following Laravel commands:
protected function schedule(Schedule $schedule) {
$schedule->command('command:daily-reset')->daily();
$schedule->command('command:monthly-reset')->monthly();
}
Then, on my server, I've set up a cron job to run once per day (at 00:00).
0 0 * * * php /home/privates/public_html/staging/current/artisan schedule:run
My cron job is running successfully each night, but the logs simply say: "No scheduled commands are ready to run."
What am I doing wrong? I would expect my daily
command to run each night.
Thanks!
The Laravel scheduled commands are based in the timezone that you have configured in your app/config/app.php file (laravel 5.1):
So if you create a command and register it to run as a scheduled task with:
it will run every day at 00:00 OF THE TIMEZONE SPECIFIED (in this case America/Bogota)
The same thing applies if you specify a time to run the task:
This will run at 02:30 am in America/Bogota local time.
Did you try running command manuallay?
Run
php artisan
and see if your commands have registered.If you have registered your commands you should see
command:daily-reset
andcommand:monthly-reset
under the list of available artisan commands.If you don't see them there go ahead and register your commands by adding it to
commands
property available inapp/Console/Kernel.php
.Change crontab entry to
* * * * * php /home/privates/public_html/staging/current/artisan schedule:run