scripts / install_dependencies.sh以root用户身份运行失败,退出代码为127

时间:2017-11-05 09:06:54

标签: linux amazon-web-services aws-code-deploy

我使用的是亚马逊Linux

错误:

2017-11-05 08:28:41 ERROR [codedeploy-agent(2818)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: InstanceAgent::Plugins::CodeDeployPlugin::ScriptError - Script at specified location: scripts/install_dependencies.sh run as user root failed with exit code 127 - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:158:in 'execute_script'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:115:in 'block (2 levels) in execute
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:103:in 'each'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:103:in 'block in execute'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:173:in 'create_script_log_file_if_needed'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:101:in 'execute'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:142:in 'block (3 levels) in map'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:130:in 'each'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:130:in 'block (2 levels) in map'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:62:in 'execute_command'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:132:in 'process_command'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:65:in 'perform'
/opt/codedeploy-agent/lib/instance_agent/agent/base.rb:28:in 'run'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:38:in 'block in run'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:55:in 'with_error_handling'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:37:in 'run'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:70:in 'block in run_with_error_handling'
/opt/codedeploy-agent/lib/instance_agent/runner/child.rb:55:in 'with_error_handling'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:69:in 'run_with_error_handling'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:33:in 'block in start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:22:in 'loop'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:22:in 'start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:206:in 'block in spawn_child'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:204:in 'fork'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:204:in 'spawn_child'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:196:in 'block in spawn_children'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:195:in 'times'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:195:in 'spawn_children'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:134:in 'start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:37:in 'block in start'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:36:in 'fork'
/opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:36:in 'start'
/opt/codedeploy-agent/bin/../lib/codedeploy-agent.rb:41:in 'block (2 levels) in <main>'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/command_support.rb:130:in 'call'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/command_support.rb:130:in 'execute'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:262:in 'block in call_command'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:275:in 'call'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:275:in 'call_command'
/opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:69:in 'run'
/opt/codedeploy-agent/bin/../lib/codedeploy-agent.rb:88:in '<main>'
2017-11-05 08:28:51 INFO  [codedeploy-agent(2818)]: Version file found in /opt/codedeploy-agent/.version.
2017-11-05 08:29:51 INFO  [codedeploy-agent(2818)]: [Aws::CodeDeployCommand::Client 200 60.056539 0 retries] poll_host_command(host_identifier:"arn:aws:ec2:us-west-2:700595817453:instance/i-032696c71ddbbe093")  

appspec.yml:

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/
permissions:
  - object: /var/www/
    owner: root
    group: root
    mode: 777
hooks:
  BeforeInstall:
    - location: scripts/install_dependencies.sh
      timeout: 300
      runas: root
  AfterInstall:
    - location: scripts/post_install.sh
      timeout: 30
      runas: root
  ApplicationStart:
    - location: scripts/start.sh
      timeout: 300

目录结构:

ant-media-server-bundle
|
|___ ant-media-server/
|___ appspec.yml
|___ scripts/

1 个答案:

答案 0 :(得分:0)