private String runCommand(String cmd, boolean result) {
        StringBuilder buf = new StringBuilder();
        String rt = "-1";
        try {
            Process pos = Runtime.getRuntime().exec(cmd);
            pos.waitFor();
            if (!result) {
                rt = String.valueOf(pos.exitValue());
            } else {
                InputStreamReader ir = new InputStreamReader(
                        pos.getInputStream());
                LineNumberReader input = new LineNumberReader(ir);
                String ln = null;
                while ((ln = input.readLine()) != null) {
                    buf.append(ln + lineSeparator);
                }
                rt = buf.toString();

                InputStreamReader eir = new InputStreamReader(
                        pos.getErrorStream());
                LineNumberReader eInput = new LineNumberReader(eir);
                ln = null;
                buf.delete(0, buf.length());
                while ((ln = eInput.readLine()) != null) {
                    buf.append(ln + lineSeparator);
                }
                rt += buf.toString();

                input.close();
                eInput.close();
                eir.close();
                ir.close();
                pos.destroy();
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return rt;
    }