I have a Meteor application that I am deploying on EC2 instances using CodeDeploy (local build -> S3 -> CodeDeploy -> EC2).
I had a problem that I didn’t have a week ago: when creating a deployment at the ApplicationStop stage, it comes out with a message
[stderr]bash: /opt/codedeploy-agent/deployment-root/.../scripts/stop.sh: /bin/sh^M: bad interpreter: No such file or directory
I know this should be a Windows style line ending problem, but it doesn't seem like it
~$ md5sum stop.sh
d41d8cd98f00b204e9800998ecf8427e stop.sh
~$ dos2unix stop.sh
~$ md5sum stop.sh
d41d8cd98f00b204e9800998ecf8427e stop.sh
If I open the file in a hex editor, the end of the line will look like 0x0a , not 0x0d0a (Windows style).
00000000: 2321 2f62 696e 2f73 68 0a 736f 7572 6365 #! / Bin / sh.source
00000010: 202f 686f 6d65 2f65 6332 2d75 7365 722f / home / ec2-user /
...
, S3, - , .
, , , , (!!)... .
!
[]: stop.sh script, /bin/sh . , sudo ln -s /bin/sh /bin/sh^M , , .:/
[ 2]. , - CodeDeploy . /opt/codedeploy-agent/.../d-GBQV1EHSE, Windows... CodeDeploy /opt/codedeploy-agent/.../d-XWEJW9SVE .