Batch shutdown Linux Computers connected to LAN.
Shutdown all slave linux system connected to same network.
- Python
-
Server:-
- Copy ShutdownServer.py to a master computer.
- Move ShutdownServer.py to /usr/local/bin/.
- Open terminal and type "chmod 744 ShutdownServer.py".
- Now navigate to directory "/etc/systemd/system".
- create a file shutdown_server.service and paste the following content:-
Description=Shutdown Server Service After=dbus.service [Service] ExecStart=/usr/local/bin/ShutdownServer.py [Install] WantedBy=default.target
- Open terminal and type "chmod 744 shutdown_server.service".
- In terminal type systemctl daemon-reload
- then systemctl enable shutdown_server.service
-
Client:-
-
Copy Setup.py and node.py to a Client computer.
-
Open node.py and replace Ip with your server Ip.
-
Open terminal and run setup.py
Done
-
When you have to shutdown all slave system, just run MasterClient.py on Master system and type shutdown -R now commmand.
If you want to add more command just add command to acc array on both ShutdownServer.py and node.py.