英文:
appspec.yml does not execute scipts
问题
这是您提供的内容的中文翻译:
我正在使用AWS CodePipeline构建代码流水线,为此我构建了一个appspec.yml文件来部署在服务器上。appspec文件部分正常工作,并将代码从源位置传送到目标位置,但是它不执行代码文件夹中的脚本,并且也不报错。
以下是appspec.yml文件的内容:
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
file_exists_behavior: OVERWRITE
hooks:
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
BeforeInstall:
- location: scripts/deploy_server.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: root
以下是脚本文件的内容:
#!/bin/bash
sudo systemctl stop HYPNOS.service
sudo systemctl disable HYPNOS
sudo systemctl daemon-reload
希望这对您有所帮助。
英文:
I am building the code pipeline using aws code pipeline and for that I build a appspec.yml file to deploy on server the appspec files portion work correctly and bring the code from source to destination and then It does not execute the Scripts in the script folder of the code and also does not give any error
here is appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
file_exists_behavior: OVERWRITE
hooks:
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
BeforeInstall:
- location: scripts/deploy_server.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: root
and here is the script file
#!bin/bash
sudo systemctl stop HYPNOS.service
sudo systemctl disable HYPNOS
sudo systemctl daemon-reload
答案1
得分: 0
You need indentation after hooks
. It should be:
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
file_exists_behavior: OVERWRITE
hooks:
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
BeforeInstall:
- location: scripts/deploy_server.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: root
英文:
You need indentation after hooks
. It should be:
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
file_exists_behavior: OVERWRITE
hooks:
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
BeforeInstall:
- location: scripts/deploy_server.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: root
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论