日期:2014-05-16 浏览次数:20680 次
private int cmdExcute(int date,String cmd,String path){
Process process=null;
cmd=cmd+path;
try{
process=Runtime.getRuntime().exec(cmd);
}catch(IOException e) {
logger.info("linux error:",e);
}
InputStreamReader reader = new InputStreamReader(process.getInputStream());
BufferedReader bufferedReader = new BufferedReader(reader);
String str=null;
try{
str = bufferedReader.readLine();
}catch(IOException e1) {
logger.info("readLine error",e1);
}int count=0;////////////////////////////////唯一登陆
logger.info("cmd1=="+cmd+",result="+str);
try{
bufferedReader.close();
reader.close();
}catch(IOException e) {
logger.info("close error",e);
}finally{
if(bufferedReader!=null){
try {
bufferedReader.close();
}catch(IOException e) {
logger.info("finally close bufferedReader error",e);
}
}
if(reader!=null){
try {
reader.close();
}catch(IOException e) {
logger.info("finally close reader error",e);
}
}
}
return count;
}