|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkankan.download.listener;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.util.CmdUtils;
|
|
@@ -44,11 +45,12 @@ public class RsyncSceneListener {
|
|
|
)
|
|
|
public void buildScenePreHandler(Channel channel, Message message) throws Exception {
|
|
|
String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
+ System.out.println(msg);
|
|
|
JSONObject jsonObject = JSON.parseObject(msg);
|
|
|
String path = jsonObject.getString("path");
|
|
|
- System.out.println(msg);
|
|
|
String cmd = RSYNC_CMD.replace("$port", port).replace("$source", path).replace("$user", username).replace("$host", host).replace("$dest", dest);
|
|
|
CmdUtils.callLineSh(cmd);
|
|
|
+ FileUtil.del(path);
|
|
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
}
|
|
|
|