I want to write a script which can Shutdown remote Ubuntu system. Actually i want my VM to shutdown safely when i shutdown my main machine on which my VM is installed .
Is there is any of doing this with the help of Sh scripts or script written in any language like Python.
You can call poweroff from a script, as long as it's running with superuser privileges.
Script to Shutdown Ubuntu