Преглед изворни кода

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

wuweihao пре 2 година
родитељ
комит
0c6f5a85c9

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

@@ -21,7 +21,7 @@ public class CmdUtils {
     public static void callShell(String command){
         log.info("cmd: {}", command);
         try {
-            String[] cmd = new String[]{"/bin/sh", "-c", command + "&"};
+            String[] cmd = new String[]{"/bin/sh", "-c", command};
             Process process = Runtime.getRuntime().exec(cmd);
             StreamGobblerLine errorGobbler = new StreamGobblerLine(process.getErrorStream(), "ERROR");
             errorGobbler.start();

+ 1 - 0
720yun_fd_consumer/gis_oss/src/main/java/com/gis/oss/util/AliYunOssUtil.java

@@ -1,5 +1,6 @@
 package com.gis.oss.util;
 
+import cn.hutool.core.util.RuntimeUtil;
 import com.aliyun.oss.OSSClient;
 import com.aliyun.oss.model.*;
 import com.gis.oss.command.CmdConstant;

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

@@ -1,5 +1,6 @@
 package com.gis.oss.util;
 
+import cn.hutool.core.util.RuntimeUtil;
 import com.amazonaws.auth.AWSStaticCredentialsProvider;
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.regions.Regions;
@@ -161,7 +162,9 @@ 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);
+        log.info("cmd aws: {}", cmd);
+        RuntimeUtil.exec(new String[]{"/bin/sh", "-c"}, cmd);
 //        CmdUtils.callLine(cmd);
     }
 }