I'm trying to set up a cron job for the 1st of January on my AWS EC2 instance for ec2-user
.
When I do crontab -u ec2-user -l
, it shows the following output:
* * * * * usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
But even though the following was set up in Kernel.php
, the job never fired:
protected $commands = [
// Commands\Inspire::class,
Commands\TestYearlyJob::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('table:test-yearly-job')->cron('0 0 1 1 *')
->timezone('Europe/London')
->appendOutputTo('../taskscheduler.log');
}
The command itself runs from Artisan (I've double checked), so its logic is fine.
I'm wondering if there is a way to do it with the ->yearly()->at()
scheduling option? Or perhaps with a closure
truth test? But I'm not sure what to put in there for a when()
statement. Please help.