Score:0

Laravel Crons on Elastic Beanstalk Linux AMI 2

br flag

I am running a Laravel app on Elastic Beanstalk Linux AMI 2.

I am using the following config file in the .ebextensions folder to set up the cron.

files:
"/etc/cron.d/schedule_run":
mode: "000644"
owner: root
group: root
content: |
  * * * * * root . /opt/elasticbeanstalk/deployment/env && /usr/bin/php /var/www/html/php artisan schedule:run 1>> /var/laralog.log 2>&1

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

After deploying, it does not seem at all like the scheduling engine is running on the test instance. I set up a cron to write to my DB every 2 minutes and nothing is happening. Has something changed and now this code will no longer start the Laravel scheduler?

Romeo Ninov avatar
in flag
Have you try to write the command in script and run the script. Sometime `cron` do not "like:/"handle" well `&&` in command
br flag
no, I am not sure how to do that.
Romeo Ninov avatar
in flag
Put this: `. /opt/elasticbeanstalk/deployment/env && /usr/bin/php /var/www/html/php artisan schedule:run 1>> /var/laralog.log 2>&1` in file (in `root` home directory, Exec `chmod 700 <fillename>` and make record with time to be: `* * * * * root /path/to/your/script`
br flag
but wouldnt that start the scheduler over and over again?
Romeo Ninov avatar
in flag
I do not get it. What I propose do not change the logic.
br flag
ok, can i put that file in the .ebextensions folder?
br flag
just a regular .txt file? .php file?
Romeo Ninov avatar
in flag
It can be any extension, in UNIX/Linux they are not in charge like Windows. But you can add `.sh`
br flag
thanks. either way, it still does not seem to work.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.