StringBuffer buf = new StringBuffer(1000); try { Process pos = Runtime.getRuntime().exec("sh " + cmd); pos.waitFor(); InputStreamReader ir = new InputStreamReader(pos.getInputStream()); LineNumberReader input = new LineNumberReader(ir); String ln=""; while ((ln =input.readLine()) != null) { buf.append(ln+"<br>"); } logger.info(buf.toString()); input.close(); ir.close(); } catch (Exception e) { logger.error("###flush Kerberos command error:" + e); }
时间: 2024-10-14 20:13:59