Java调用shell脚本
程序员文章站
2024-02-19 13:58:06
...
String bashCommand = "/home/go/script/restart_go.sh"; //①
Runtime runtime = Runtime.getRuntime();
Process pro = runtime.exec(bashCommand); //②
int status = pro.waitFor(); //③
if (status != 0){ //④
logger.error("restart go server error");
return;
}
logger.info("restart go server success");
上一篇: Tomcat相关配置总结
下一篇: 15 Python学习之装饰器