public void process() {
File wd = new File("/bin");
System.out.println(wd);
String cmdPath = "cd /pdmdata2/cluster1/apps";
Process proc = null;
try {
//确定是sh还是ksh模式
proc = Runtime.getRuntime().exec("/bin/ksh", null, wd);
} catch (IOException e) {
e.printStackTrace();
}
if (proc != null) {
BufferedReader in = new BufferedReader(new InputStreamReader(proc
.getInputStream()));
PrintWriter out = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(proc.getOutputStream())), true);
out.println(cmdPath);
out.println("pwd");
out.println("/refreshcache.sh");
out.println("exit");
try {
proc.waitFor();
in.close();
out.close();
proc.destroy();
} catch (Exception e) {
e.printStackTrace();
}
}
}