```
/**
* 执行Linux命令
* @param commands 可执行多条命令
* @throws Exception
*/
public static void exec(List<String> commands) throws Exception {
// 指定脚本执行目录为根目录,然后cd到程序的目录中执行shell脚本
// 这样做是为了能够在进程中获得运行脚本的全路径,直接使用new File()来指定工作目录获取不到
File wd = new File("/");
Process process = null;
process = Runtime.getRuntime().exec("/bin/bash", null, wd);// wd可选
if (process != null) {
BufferedReader in = new BufferedReader(new InputStreamReader(
process.getInputStream()));
PrintWriter