SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

Wednesday, July 3, 2013

Remote shutdown one line ssh command

Q.) How to shut down / restart  a remote linux server from ssh ?

A.)  ssh -t user@hostname 'sudo shutdown -P now'

In the above example
-t  : forces the allocation of a tty for the command.
-P : stands for power off.
-r  : to reboot.
-h : to halt. 

Also all the shutdown arguments can be passed along. To know more about shutdown options run command.
shutdown --help

No comments:

Post a Comment