aws codedeploy长时间运行的进程
问题描述:
正在应用Aws codedeploy。 appspec文件如下所示。aws codedeploy长时间运行的进程
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
我试过成功,直到AfterInstall。 它在applicationStart中仍处于待处理状态。 AfterInstall安装了Java文件并设置了权限。
chmod 755 ${file_HOME}/bin/install_api
chmod 755 ${file_HOME}/bin/install_web
自动运行已设置。
/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位于下方。
#!/bin/bash
# start InnerBeans
sudo service install_api start &
sleep 5
sudo service install_web start &
sleep 5
答
当调用一个LifeCycleEvent脚本codedeploy剂(版本OFFICIAL_1.0-1.1106_rpm)内的后台进程或守护进程保持挂起直到70分钟超时。 首先,尝试删除&
这样的:
#!/bin/bash
# start InnerBeans
sudo service install_api start
#sleep 5
sudo service install_web start
#sleep 5
如果还是失败,你可能有初始化脚本中的背景或进程进程化,所以你需要重定向输出,输出和错误。
尝试:
#!/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
这第二种方式为我工作。 我发现这里的解决方案: https://forums.aws.amazon.com/thread.jspa?messageID=626766򙁎 这里 http://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-deployments.html#troubleshooting-long-running-processes
你能否提供更多细节?错误/结果是什么?你可以检查部署日志以查看目前运行的代码部署吗?以下是查找方法:https://docs.aws.amazon.com/codedeploy/latest/userguide/deployments-view-logs.html#deployments-view-logs-instance-unix – Asaf