user2764735
user2764735

Reputation: 21

Restart remote servers with a Python script

I'm trying to write a Python script that will restart a series of servers on the same network in a specified sequence. I have used os.system('shutdown /r') to restart my own machine, but I cannot find the documentation to shutdown remote servers with usernames and passwords. I eventually want to run the Python script from a Raspberry Pi on the push of a button. Can someone point me in the right direction?

Upvotes: 2

Views: 6901

Answers (2)

Alberto Megía
Alberto Megía

Reputation: 2255

If you can access those servers through SSH, try Fabric

Very useful tool!

Upvotes: 2

Aaron Digulla
Aaron Digulla

Reputation: 328870

This article explains in detail how to configure remote shutdown for Windows: http://www.howtogeek.com/109655/how-to-remotely-shut-down-or-restart-windows-pcs/

Note that you will need Samba to get a net command which you can run from Linux.

If that is no available, then the workaround is to write a small server in Python which you install on a Windows box which accepts the "restart everything" command from the Pi (use a plain socket server but implement some kind of password protection).

Upvotes: 4

Related Questions