0

I have an issue with my script. I use beanstalk to deploy my ASP.NET Core code. And in my post deploy I have this code:

#!/usr/bin/env bash
file1=sudo cat /opt/elasticbeanstalk/config/ebenvinfo/region
file2=/opt/elasticbeanstalk/bin/get-config container -k environment_name
file3=$file2.$file1.elasticbeanstalk.com
echo $file3
sudo certbot -n -d $file3 --nginx --agree-tos --email al@gmail.com

It works perfectly if I launch it on the instance but in the postdeploy script I have the error:

[ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPostDeployHooks]. Stop running the command. Error: Command .platform/hooks/postdeploy/00_get_certificate.sh failed with error fork/exec .platform/hooks/postdeploy/00_get_certificate.sh: exec format error

PS: My script has .ebextension which allows exec rights

container_commands:
  00_permission_hook:
    command: "chmod +x .platform/hooks/postdeploy/00_get_certificate.sh"

What's wrong?

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
dalton5
  • 845
  • 2
  • 13
  • 27
  • Can you try with `#!/bin/bash`? – Marcin Nov 17 '21 at 00:39
  • I have the same error – dalton5 Nov 17 '21 at 08:11
  • Platform scripts are run as root, so there is not need to use sudo in them. Also if you are using git, add execution permission like this may change it - https://stackoverflow.com/questions/40978921/how-to-add-chmod-permissions-to-file-in-git/40979016#40979016 – gowthz Nov 27 '21 at 04:34

0 Answers0