I'm using Bitbucket pipeline to install my Node application to an EC2 linux instance. The AppSpec.yml file at the root of my application defines the deployment. Before I install, I want to stop all Node processes running on the target server. Here's my BeforeInstall hook:
BeforeInstall:
- location: deploy/killallnode.sh
timeout: 30
runas: root
The command inside the script is:
killall node
The deployment failed and here's what I find in AWS:
LifecycleEvent - BeforeInstall
Script - deploy/killallnode.sh
[stderr]node: no process found
This error is to be expected. How can I suppress this at the command line, or configure the AppSpec hook to ignore this error? Thanks for your advice!
I tried changing my script command to:
killall node 2> /dev/null
This suppressed the error message, but the killall command still returned an error code of 1.
There is a property which controls this. IgnoreApplicationStopFailures
Here's how it is implemented in yaml:
version: 0.0
os: linux
IgnoreApplicationStopFailures: true
files:
- source: /
destination: /api
hooks:
...etc...