-1
我有一個需要參數的腳本bash。bash腳本在jee上調用時不起作用
當我直接從膩子調用它,它的工作原理,如果我從我的jee程序做它不起作用,並不會顯示任何錯誤。
這是我的Java代碼:
String[] cmdArray = {"sudo", "ssh", "-tt", "[email protected]", "/root/dve", "-l", "89.40.112.120,89.40.112.248", "you.mp4", "-s",".teeeest.avi" };
List<ObjectNode> listFileNode = new ArrayList<ObjectNode>();
try{
Runtime rt = Runtime.getRuntime();
ProcessBuilder pb = new ProcessBuilder(cmdArray);
Process proc = pb.start(); // Start the process.
System.out.println("Script executing");
rc= proc.waitFor(); // Wait for the process to finish.
System.out.printf("Script executed successfully in ", rc);
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
System.out.println("<ERROR___EXEC>");
while ((line = br.readLine()) != null){
System.out.println(line);
node.put("line",line);
listFileNode.add(node);
}
System.out.println("</ERROR___EXEC>");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
InputStream processInputStream =proc.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(processInputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
System.out.println("<RESULTAT___EXEC>");
while ((line = bufferedReader.readLine()) != null){
System.out.println(line);
node.put("lineR",line);
listFileNode.add(node);
}
System.out.println("</RESULTAT___EXEC>");
}catch (Throwable t)
{
t.printStackTrace();
}
,請幫助我,我被困在這個從一個星期,我沒有找到解決辦法
在這裏只需要足夠的代碼來重現問題。 – sjsam
嗨,我放的java代碼是我的彈簧控制器,我想運行的腳本可以在這裏找到:https://github.com/nergdron/dve –