I have a Linux script which I require to get executed just before the host is going down.
Where do I need to place the file in order to work?
In Ubuntu/CentOS:
Keep your script in /etc/init.d/ and create a symbolic link in /etc/rc0.d started by K50 (K for kill, 50 for execution priority)
ln -s /etc/init.d/your_script.sh /etc/rc0.d/K01your_script