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
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