CodeDeploy:指定位置的脚本:scripts/stop_server 以 root 用户身份运行失败,退出代码为 1

Ada*_*ela 6 amazon-ec2 amazon-web-services continuous-deployment aws-codepipeline

无论我在stop_server文件中放入什么内容,CodeDeploy 都会出现上述错误。我什至注释掉了所有行以简化调试,所以现在它看起来像这样

#!/bin/bash
# pkill -f node
Run Code Online (Sandbox Code Playgroud)

我的appspec.yml

version: 0.0
os: linux
files:
  - source: /app.js
    destination: /home/ec2-user/node-website
  - source: /package.json
    destination: /home/ec2-user/node-website
  - source: /public/
    destination: /home/ec2-user/node-website/public
  - source: /node_modules
    destination: /home/ec2-user/node-website/node_modules

permissions:
  - object: /
      pattern: "**"
      owner: ec2-user
      group: ec2-user

hooks:
  AfterInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: ec2-user
    #- location: scripts/codestar_remote_access
    #  timeout: 300
    #  runas: ec2-user
    - location: scripts/start_server
      timeout: 300
      runas: ec2-user

  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: ec2-user
Run Code Online (Sandbox Code Playgroud)

任何建议都将受到高度赞赏!

Cal*_*hou 0

您可以检查代码部署日志以查找更多详细信息,日志通常位于:

/opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log 
Run Code Online (Sandbox Code Playgroud)

查找更详细的错误日志,如果您仍然无法弄清楚,请告诉我