#!/usr/bin/env python import socket import os HOST = '' # Endereco IP do Servidor PORT = 5000 # Porta que o Servidor esta udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) orig = (HOST, PORT) udp.bind(orig) while True: msg, cliente = udp.recvfrom(1024) print cliente, msg if msg == "desligar": os.system("sudo shutdown -h now") if msg == "reiniciar": os.system("sudo init 6") if msg == "reboot": os.system("sudo reboot") udp.close()