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:
- https://unix.stackexchange.com/questions/48973/execute-a-command-before-shutdown/48975
- https://unix.stackexchange.com/questions/276835/prevent-shutdown-using-shell-script-run-at-shutdown
- https://fitzcarraldoblog.wordpress.com/2018/01/13/running-a-shell-script-at-shutdown-only-not-at-reboot-a-comparison-between-openrc-and-systemd/
- https://opensource.com/life/16/11/running-commands-shutdown-linux
None of them worked for me.
Quick response with proven solution is appreciated.
can anybody help me to get this resolve.? – zlogic – 2019-05-24T06:18:33.340