-2

I have a Django web application that is deployed to AWS elastic beanstalk (Python 3.7 running on 64bit Amazon Linux 2/3.1.3). I am trying to run the following config file

files:
    "/usr/local/bin/cron_tab.sh":
        mode: "000755"
        owner: root
        group: root
        content: |
            #!/bin/bash
            exec &>> /tmp/cron_tab_log.txt
            date > /tmp/date
            source /var/app/venv/staging-LQM1lest/bin/activate
            cd /var/app/current
            python manage.py crontab add
            exit 0

container_commands:
    cron_tab:
        command: "curl /usr/local/bin/cron_tab.sh | bash"

This file placed in the .ebextentions folder. All other config files are working properly. However, this one is not working. Also, I have tried to run the container_commands code manually on SSH and it gives output such as below.

curl: (3) <url> malformed

I also checked the /tmp folder but there is no cron_tab_log.txt. I checked /usr/local/bin the cron_tab.sh is located there.

I just want this Django-crontab run after the deploy and it doesn't work. How can I handle this issue?

Murat Demir
  • 716
  • 7
  • 26
  • 2
    `curl` is a utility used for making web requests. Why are you using it here? Did you mean to do `bash /usr/local/bin/cron_tab.sh` instead of `curl /usr/local/bin/cron_tab.sh | bash`? – jordanm Feb 02 '21 at 19:53

1 Answers1

1

Curl is used for web url call not executing a script, I think you need to change the last line in your config file to be:

command: "sudo /usr/local/bin/cron_tab.sh"

Asri Badlah
  • 1,949
  • 1
  • 9
  • 20