3

I've read the elastic beanstalk Periodic Tasks manual here, and after looking at this code in the cron.yaml file:

version: 1
cron:
 - name: "backup-job"          # required - unique across all entries in this file
   url: "/backup"              # required - does not need to be unique
   schedule: "0 */12 * * *"    # required - does not need to be unique

Im not sure how to execute the following command:

 php /var/www/html/myfolder/task.php

should the url be just "/var/www/html/myfolder/task.php" or "php /var/www/html/myfolder/task.php"?

Eran Shmuel
  • 149
  • 2
  • 15

1 Answers1

0

The url value is what will be called by the SQS daemon on the worker instance when executing the task. In your case, the daemon will connect to localhost and make the following request:

POST /backup HTTP/1.1
Host: localhost
User-Agent: aws-sqsd/1.1
Content-Type: application/json
...

as described here.

In other words, your script should run when executing:

curl -X POST http://localhost/backup

from the worker instance.

Francis Eytan Dortort
  • 1,407
  • 14
  • 20