Home > Back-end >  Can't create file elastic beanstalk
Can't create file elastic beanstalk

Time:01-04

I run a django app on eb. My goal is to create a cron script in /etc/cron.d at deployment time that runs django jobs. I tried to create it using a an eb configuration file, but so far I've been unable to create any file anywhere (manually checked by sshing into the host).

Platform: Python 3.7 running on 64bit Amazon Linux 2/3.3.9

The content of cron.config looks like this:

files:
  "/etc/cron.d/cron_job":
    mode: "000644"
    owner: root
    group: root
    content: |
      * * * * * root echo "Cron running at "`date` > /home/ec2-user/cron_job.log

What I've tried is following. In all cases, app deploys but no file created.

  1. Placing cron.config in .ebextensions folder.
  2. Placing cron.config in .platform/hook/postdeploy folder. Log says "The dir .platform/hooks/postdeploy/ does not exist in the application. Skipping this step...".
  3. Specify file location as /tmp/cron_job.
  4. Specify file location as /home/ec2-user/cron_job.

Would appreciate any help.

CodePudding user response:

There is nothing wrong with your cron.config and it creates /etc/cron.d/cron_job. It works as expected as I run it on my own EB application. Whatever is happening is due to some other factors/code which is not shown in your question.

  • Related