In Laravel, in my Kernel, I have:
protected $commands = [
Commands\SendRenewEmails::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
$schedule->command('renew:emails')
->daily();
}
The said function renew:emails
, works as intended if I run this manually trough Artisan.
And in my crontab I have:
* */8 * * * cd /path-to-my-project && php artisan schedule:run >> /dev/null 2>&1
I have this to run every 8th hour, instead of every minute at * * * * *
, since this is live for testing, and just to ensure that the task wasnt run every minute.
So how does Laravel know, when to run the daily job on the kernal, and when does this happen?
From this setup (which seems to be the basic setup for cronjobs in Laravel, but to run every minute instead of every 8th hour), there is no logs (that I can see), and no table in DB to keep track of this.
So if I where to set my cron to * * * * *
, how does Laravel know not to run the scheduled job every minute, just because I have put ->daily();
at the end of the job?
And when I have daily();
, at what specific time is that? And at specific what time is hourly();
?
TL;DR:
How does Laravel know not to run the same jobs again if it is not supposed to, for example with daily();
rule? Where is this information stored? How can I be certain that a job with rule daily();
wont run every minute if my cronjobs std:out
's php artisan schedule:run
every minute?