private final static String FILL_EVENT_SCRIPT = "/opt/soft/kettle/run/run_report.sh"; //shell脚本的路径位置
private void processEvent(String reportName, String context) throws Exception {
logger.info("reportName: " + reportName + " | context: " + context);
File f = new File(FILL_EVENT_SCRIPT);
if (f.exists()) {
String[] cmd = { FILL_EVENT_SCRIPT, "-c", reportName, context};
Process process = Runtime.getRuntime().exec(cmd);
InputStreamReader ir = new InputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line = null;
process.waitFor();
while ((line = input.readLine()) != null) {
logger.info(line);
}
if (ir != null) {
ir.close();
}
if (input != null) {
input.close();
}
} else {
logger.info("file is not exists");
}
}
private void processEvent(String reportName, String context) throws Exception {
logger.info("reportName: " + reportName + " | context: " + context);
File f = new File(FILL_EVENT_SCRIPT);
if (f.exists()) {
String[] cmd = { FILL_EVENT_SCRIPT, "-c", reportName, context};
Process process = Runtime.getRuntime().exec(cmd);
InputStreamReader ir = new InputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line = null;
process.waitFor();
while ((line = input.readLine()) != null) {
logger.info(line);
}
if (ir != null) {
ir.close();
}
if (input != null) {
input.close();
}
} else {
logger.info("file is not exists");
}
}