Hot answers tagged 12.04
It seems you nginx server is handle by an upsatart process. Look in the /etc/init folder, and check if there is not a file which handles nginx. grep -r nginx /etc/init Then edit this file, and remove the respawn option in the config file.
Solved. The thing I didn't take into account is that the script is exectuted as root and not with my user. So when running ssh, password is required as I only set up the keys for my user. The workaround I used is forcing ssh to use my user keys: ssh -i /home/user/.ssh/id_rsa user@remote sudo halt
Only top voted, non community-wiki answers of a minimum length are eligible