Configure time consuming Shell script execution before shutdown linux instance

0

I am looking for the solution to configure a shell script which will successfully execute when linux instance is shutdown. but there is a challenge, I required network to execute my shell script also my script should finish before the shutdown.

Let me describe my scenario:

There are 5 aws ec2 instance.

let's say bootstrap-inst, a-inst, b-inst, c-inst, d-inst

I have written a script to stop these instances in a specific sequence except bootstrap-inst. Now I want this script to be configured in bootstrap-inst such a way that, when I stop bootstrap-inst : my script will execute before the bootstrap instance shutdown. (the trigger to execute my script is shutdown/stop).

Can anybody have any suggestion or solution to achieve this. I have tried following approaches:

None of them worked for me.

Quick response with proven solution is appreciated.

zlogic

Posted 2019-05-13T06:38:51.597

Reputation: 1

can anybody help me to get this resolve.? – zlogic – 2019-05-24T06:18:33.340

No answers