Browse Source

消费端,修改上传脚本命令-callLine

wuweihao 2 years ago
parent
commit
f06ffe695e

+ 0 - 53
720yun_fd_consumer/gis_oss/src/main/java/com/gis/oss/command/CmdUtils.java

@@ -35,59 +35,6 @@ public class CmdUtils {
 
 
 
-    /**
-     * 命令运行结果 1:失败, 0:成功
-     * @return
-     * @throws IOException
-     * @throws InterruptedException
-     */
-    public static int cmdPano(String command) throws IOException, InterruptedException {
-        log.info("cmd: {}", command);
-//        String[] cmd = new String[]{"/bin/sh", "-c", command};
-//        Process exec = Runtime.getRuntime().exec(cmd);
-
-        // 使用 bin/sh 这个方法会报错
-        Process exec = RuntimeUtil.exec(command);
-
-        BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
-        BufferedReader errorBuf = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
-
-        String errorLine;
-        while ((errorLine = errorBuf.readLine()) != null) {
-            log.error("errorLine: {}", errorLine);
-        }
-
-        // success ,没有获取到信息
-        String line;
-        int i = 1;
-        while ((line = br.readLine()) != null) {
-
-            // 查看执行日志
-            if (i % 200 == 0) {
-                log.info("line, i=" + i +", " +line);
-            }
-
-            if (line.contains("done.")) {
-                log.info("line: {}", line);
-            }
-            i++;
-        }
-        log.info("执行总行数:" +i);
-
-        // 结束命令行
-        int isCmd = exec.waitFor();
-
-        // 关闭流
-        br.close();
-        errorBuf.close();
-
-        return isCmd;
-
-    }
-
-
-
-
     public static void callLine(String command){
         callLine(command, null);
 

+ 2 - 1
720yun_fd_consumer/gis_oss/src/main/java/com/gis/oss/util/AwsOssUtil.java

@@ -161,6 +161,7 @@ public class AwsOssUtil {
 
     public void uploadBySh(String filePath, String key) {
         String cmd = String.format(CmdConstant.UPLOAD_DIR, bucket, filePath, key , "aws");
-        CmdUtils.callShell(cmd);
+         // CmdUtils.callShell(cmd);
+        CmdUtils.callLine(cmd);
     }
 }