We know how to force shutdown an computer using Java. For example, the following code works fine for force shutdown:
public static void main(String arg[]) throws IOException{
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("shutdown -s -t 0");
System.exit(0);
}
Now, suppose if I want to force startup a computer (which is in shut down state), at a particular time, is it possible to do in Java or any other language?
Go to the Start menu, type Power Options in Search box. Click it from the result. Then click Additional power settings under related settings. Click Change plan settings > Change advanced power settings, expand the "Sleep" section, expand the "Allow wake timers" section, and ensure it's set to "Enable".
Force a restart If the usual computer repair restart methods aren't working, you can force your computer to restart by holding down the power button until it shuts down, then pushing it again to start your machine. This should work.
Expand Task Scheduler Library and select the Schedule Reboot folder. Then right-click on it and select Create Basic Task. When you select Create Basic Task, it will open a wizard. Name it Reboot and click Next.
You need something to trigger the startup. The best way to trigger this is Wake On Lan.
If you want to do this in Java, this might be a good resource.
In addition to wake on lan, there are IPMI devices that run on some server-grade hardware that is connected to the motherboard and can control power as well as provide serial console output over a network connection. This computer is running all the time, but I'm not familiar with any you can load your own code onto.
You can control this device remotely to power control the server that is off from any language including java.
http://en.wikipedia.org/wiki/Intelligent_Platform_Management_Interface
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With