Reputation: 27
Aws codedeploy is being applied. The appspec file is shown below.
version: 0.0
os: linux
files:
- source: script/install-file.sh
destination: /home/
hooks:
AfterInstall:
- location: script/install-file.sh
timeout: 120
runas: root
ApplicationStart:
- location: script/start-file.sh
timeout: 120
runas: root
I tried Succeeded until AfterInstall. It is still pending in applicationStart. AfterInstall installed Java files and set permissions.
chmod 755 ${file_HOME}/bin/install_api
chmod 755 ${file_HOME}/bin/install_web
Auto-run was set.
/bin/cp ${file_HOME}/bin/install_api /etc/init.d
/bin/cp ${file_HOME}/bin/install_web /etc/init.d
Chkconfig --add ib_api
Chkconfig --add ib_web
start-file.sh is below.
#!/bin/bash
# start InnerBeans
sudo service install_api start &
sleep 5
sudo service install_web start &
sleep 5
Upvotes: 0
Views: 1434
Reputation: 641
When calling background processes or daemons inside a LifeCycleEvent script codedeploy-agent (version OFFICIAL_1.0-1.1106_rpm) remains pending until 70 minutes timeout.
First, try removing &
like this:
#!/bin/bash
# start InnerBeans
sudo service install_api start
#sleep 5
sudo service install_web start
#sleep 5
If it still failing, you probably have background or daemonized processes inside the init script so you need to redirect outputs stdout and stderr.
Try:
#!/bin/bash
# start InnerBeans
sudo service install_api start > /dev/null 2>&1
#sleep 5
sudo service install_web start > /dev/null 2>&1
#sleep 5
That second way worked for me. I found the solution here: https://forums.aws.amazon.com/thread.jspa?messageID=626766򙁎 and here http://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-deployments.html#troubleshooting-long-running-processes
Upvotes: 1