import java.io.IOException;
public class SetUpToLed {
//时区同步设置
public static void setTimeZone(String timeZoneStr) {
//timeZoneStr = "Pacific/Guam";
String timezone = "sudo cp -f /usr/share/zoneinfo/" + timeZoneStr
+ " /etc/localtime";
System.out.println(timezone);
try {
String[] cmds = { "/bin/sh", "-c", timezone };
Process pro = Runtime.getRuntime().exec(cmds);
pro.waitFor();
Thread.sleep(2000);
Process pro1 = Runtime.getRuntime().exec("sudo reboot");
pro1.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//重启系统
public void reBootSystem() throws IOException, InterruptedException{
Process pro1 = Runtime.getRuntime().exec("sudo reboot");
pro1.waitFor();
}
}
public class SetUpToLed {
//时区同步设置
public static void setTimeZone(String timeZoneStr) {
//timeZoneStr = "Pacific/Guam";
String timezone = "sudo cp -f /usr/share/zoneinfo/" + timeZoneStr
+ " /etc/localtime";
System.out.println(timezone);
try {
String[] cmds = { "/bin/sh", "-c", timezone };
Process pro = Runtime.getRuntime().exec(cmds);
pro.waitFor();
Thread.sleep(2000);
Process pro1 = Runtime.getRuntime().exec("sudo reboot");
pro1.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//重启系统
public void reBootSystem() throws IOException, InterruptedException{
Process pro1 = Runtime.getRuntime().exec("sudo reboot");
pro1.waitFor();
}
}