'Elastic beanstalk cron with laravel schedule

I have just made two schedule in laravel. Register them in kernel like this

 $schedule->command('jobs:expire')->everyMinute();
 $schedule->command('jobs_schedule:notify')->everyMinute();

Made folder on root named .ebextensions and create file in it named cronjob.config with code below.

files:
  "/etc/cron.d/mycron":
    mode: "000644"
    owner: root
    group: root
    content: |
      * * * * * root . /opt/elasticbeanstalk/support/envvars && /usr/bin/php /var/www/html/project/artisan schedule:run 1>> /dev/null 2>&1

commands:
  remove_old_cron:
    command: "rm -f /etc/cron.d/*.bak"

But it is not working on server. Other than that it runs through artisan command line successfully am mi missing out something?



Solution 1:[1]

It's highly likely you are running on Amazon Linux 2, in which case the environment variables are stored under /opt/elasticbeanstalk/deployment/env instead. Just replace the mentioned path in your config and you should be good.

Source: I followed similar guide and ran into the same issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pkid169