Java Linux 时区同步设置和重启 arm端
来源:互联网 发布:淘宝网的卖家中心在哪 编辑:程序博客网 时间:2024/06/05 08:42
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();
}
}
阅读全文
0 0
- Java Linux 时区同步设置和重启 arm端
- 设置linux时区和同步时间
- Linux 修改时间,时区和设置时间自动同步
- linux系统时间同步,硬件时钟和系统时间同步,时区的设置
- utc时区和ntp同步设置
- centos7时间同步和时区设置
- linux设置时区和时间
- linux设置时间和时区
- linux下修改时区、时间同步、开机自启时间同步设置
- 修改LINUX时区和同步时间
- ARM linux 时区开发
- Linux下jvm时区设置-JAVA时区问题
- linux 时区和时间服务器 设置命令
- 嵌入式linux设置时间和时区
- Linux的时间和时区设置
- Linux设置和修改时间与时区
- Linux的时间和时区设置
- ubuntu之设置时区和在线同步时间
- 【期刊&&会议】机器学习&&深度学习 + 计算机视觉(To be continued..)
- groovy 文件的读取
- java线程池常用类
- BZOJ3402: [Usaco2009 Open]Hide and Seek 捉迷藏
- 单点登录原理与简单实现
- Java Linux 时区同步设置和重启 arm端
- 关于NetKeeper(创翼)升级后,无法共享WIFI问题的解决-猎豹、360都可
- 服务器常用状态码以及它的含义
- Android开发错误记录:MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- Java虚拟机笔记--2
- Spring 注解大全
- QTP应用实例-G.8032测试自动化(4)数据扩展
- 将多个jar包重新打包成一个jar包
- 《Kali+Linux渗透测试的艺术》学习总结之----概要