Commit f711cd90 authored by aninhacostaribeiro's avatar aninhacostaribeiro
Browse files

Updated Wake on lan

parent 593b6158
......@@ -3,6 +3,7 @@ package org.fogbowcloud.green.server.communication;
import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.fogbowcloud.green.server.core.greenStrategy.GreenStrategy;
import org.jamppa.component.XMPPComponent;
import org.xmpp.packet.IQ;
......@@ -10,6 +11,7 @@ import org.xmpp.packet.IQ.Type;
public class ServerCommunicationComponent extends XMPPComponent {
private static final Logger LOGGER = Logger.getLogger(ServerCommunicationComponent.class);
private GreenStrategy gs;
private Properties prop;
......@@ -22,10 +24,14 @@ public class ServerCommunicationComponent extends XMPPComponent {
addHandlers();
}
public void wakeUpHost(String macAddress) throws IOException {
public void wakeUpHost(String macAddress) throws IOException, InterruptedException {
LOGGER.debug("Wake command: powerwake -b " +
prop.getProperty("wol.broadcast.address") + " " + macAddress);
ProcessBuilder pb = new ProcessBuilder("powerwake", "-b",
prop.getProperty("wol.broadcast.address"), macAddress);
pb.start();
Process process = pb.start();
process.waitFor();
}
public void sendIdleHostToBed(String hostJID) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment