2017-04-23 49 views
0

當我AWSCodeDeploy創建一個新的部署與GitHub上我收到這個失敗Codedeploy代理錯誤消息:在亞馬遜的Linux實例中運行時

Error CodeScriptFailed 
Script Namescripts/stop_server.sh 
MessageScript at specified location: scripts/stop_server.sh run as user ubuntu failed with exit code 1 
Log TailLifecycleEvent - ApplicationStop 
Script - scripts/stop_server.sh 
[stderr]su: user ubuntu does not exist 

但是,我的例子是一個Amazon Linux實例並沒有一個ubuntu用戶,任何人都知道這件事?

一個嘗試運行的腳本是:

# scripts/stop_server.sh 
#!/bin/bash 
forever stop . 

我appspec.yml文件:

version: 0.0 
os: linux 
files: 
    - source:/
    destination: /home/ec2-user 
hooks: 
    AfterInstall: 
    - location: scripts/install_dependencies.sh 
     timeout: 5 
     runas: root 
    ApplicationStart: 
    - location: scripts/start_server.sh 
     timeout: 5 
     runas: root 
    ApplicationStop: 
    - location: scripts/stop_server.sh 
     timeout: 5 
     runas: root 

Codedeploy代理版本agent_version: OFFICIAL_1.0-1.1095_rpm

回答

0

Application stop通常是指在appspec.yml以前成功的部署檔案。要麼是空的/opt/codedeploy-agent/deployment-archive/deployment-instructions/,要麼您可以使用BeforeInstall鉤子來執行停止腳本。

+0

嗨@Ravi很抱歉很久沒有回覆你了。 感謝您的幫助。 我解決了刪除具有問題的應用程序並創建一個新問題的問題。我相信這個問題是無情的,ApplicationStop鉤子。 –

0

代碼部署在/ opt/code-deploy/....路徑中創建臨時應用程序。如果部署失敗,它會在下次從臨時目錄開始。如果您想擺脫部署指向的錯誤,您應該檢查臨時目錄中的特定腳本文件並對其進行編輯。