vendredi 29 mai 2015

Shutdown scripts to run upon AWS termination

I am trying to get some scripts to run upon an aws termination action. I have created /etc/init.d/Script.sh and linked symbolically to /etc/rc01.d/K01Script.sh

However terminating through aws console did not produce the output I was looking for. (It is a script that does a quick API call to a server over https should take only a few seconds).

Then I tried again but specifically changed a kernel parameter: 'sudo sysctl -w kernel.poweroff_cmd=/etc/rc0.d/K01Script.sh'

and again no output.

I get the message "The system is going down for power off NOW!" when terminating the server so I'm pretty sure the Ubuntu server is going into runlevel 0. Permissions are owned by root.

I know I could create a lifecycle to do something like this but my team prefers the quick and dirty way.

any help very much appreciated!




Aucun commentaire:

Enregistrer un commentaire