I am executing a shell script from a java program, in that shell script I am connecting to a datamart server and executing the resmgr command but I am unable to get output of resmgr command, If I run the same command from command line I am able getting the output.
Shell Script:
#!/bin/bash
source /opt/datamart/dataMart.env
/opt/datamart/bin/resmgr -export fgp -colNames "nName frm.dbIndex" -filter "npath($1) frm.name($2)" -noHead -sep ','
Java Program:
import java.io.*;
import java.util.*;
public class Test {
public static void main(String argsm[]) throws IOException, InterruptedException {
String cmd="./getDBIndex1.sh ~AP~Generic~Universal~Throughput \"Inbound Volume (octets)\"";
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd);
pr.waitFor();
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line=buf.readLine())!=null) {
System.out.println(line);
}
}
}