On my local environment, the cron job works fine when I execute ‘php artisan schedule:run’, but after setting it up on AWS, this command doesn’t seem to be triggering. Can anyone help troubleshoot?
File structure
[Project root]
|-- .ebextensions
| |-- cronjob.config
cronjob.config
files:
"/etc/cron.d/schedule_run":
mode: "000644"
owner: root
group: root
content: |
* * * * * root . /opt/elasticbeanstalk/support/envvars && /usr/bin/php /var/www/html/artisan schedule:run 1>> /dev/null 2>&1
commands:
remove_old_cron:
command: "rm -f /etc/cron.d/*.bak"
Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command(DeleteRecord::class)->everyMinute()->onOneServer();
}
environment
- PHP 8.0
- Laravel 9
Recognized by PHP Collective
New contributor
Muhammad Bilal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.