import java.util.*;
import java.io.*;
public class ShutDown {
public static void main(String[] args) {
int minutes = Integer.valueOf(args[0]);
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
ProcessBuilder processBuilder = new ProcessBuilder("shutdown",
"/s");
try {
processBuilder.start();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}, minutes * 60 * 1000);
System.out.println(" Shutting down in " + minutes + " minutes");
}
}
No comments:
Post a Comment