diff --git a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java index 63f485e..87139bd 100644 --- a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java +++ b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java @@ -1,6 +1,7 @@ package io.wdd.agent.executor; import com.google.common.io.ByteStreams; +import io.wdd.agent.config.utils.AgentCommonThreadPool; import io.wdd.agent.executor.redis.StreamSender; import io.wdd.agent.executor.thread.LogToArrayListCache; import io.wdd.common.beans.executor.ExecutionMessage; @@ -40,9 +41,13 @@ public class CommandExecutor { * @param executionMessage get from EXECUTOR_HANDLER */ public void execute(ExecutionMessage executionMessage) { - this.execute( - executionMessage.getResultKey(), - executionMessage.getCommandList() + + // 防止阻塞消息队列中的其他信息,需要使用异步执行 + AgentCommonThreadPool.pool.submit( + () -> this.execute( + executionMessage.getResultKey(), + executionMessage.getCommandList() + ) ); } diff --git a/agent/src/main/java/io/wdd/agent/executor/FunctionExecutor.java b/agent/src/main/java/io/wdd/agent/executor/FunctionExecutor.java index f37f676..2ce28ff 100644 --- a/agent/src/main/java/io/wdd/agent/executor/FunctionExecutor.java +++ b/agent/src/main/java/io/wdd/agent/executor/FunctionExecutor.java @@ -2,6 +2,7 @@ package io.wdd.agent.executor; import com.alibaba.nacos.api.config.listener.Listener; import com.alibaba.nacos.api.exception.NacosException; +import io.wdd.agent.config.utils.AgentCommonThreadPool; import io.wdd.agent.config.utils.NacosConfigurationCollector; import io.wdd.common.beans.executor.ExecutionMessage; import lombok.extern.slf4j.Slf4j; @@ -44,7 +45,10 @@ public class FunctionExecutor { completeCommandList = ALL_FUNCTION_MAP.get(executionMessage.getType()); } - this.execute(resultKey, completeCommandList); + // 防止阻塞消息队列中的其他信息,需要使用异步执行 + AgentCommonThreadPool.pool.submit( + () -> this.execute(resultKey, completeCommandList) + ); } diff --git a/index.html b/index.html index b3cbb6d..5ff74d9 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,46 @@ + -Index of /octopus-agent/ + + + -

Index of /octopus-agent/


../
-octopus-agent-2022-12-26-16-00-00.jar              27-Dec-2022 07:01            46309416
-

+ + + diff --git a/source/src/main/java/io/wdd/source/shell/function/load50cpu_2_hour.sh b/source/src/main/java/io/wdd/source/shell/function/load50cpu_2_hour.sh index 29a1ddb..d3d7615 100644 --- a/source/src/main/java/io/wdd/source/shell/function/load50cpu_2_hour.sh +++ b/source/src/main/java/io/wdd/source/shell/function/load50cpu_2_hour.sh @@ -6,6 +6,13 @@ start_time=$(date +%s) current_time=$(date +%s) elapsed_time=$((current_time - start_time)) + +if [[ $(ps -ef | grep -v "color" |grep -c "/octopus-agent/shell/function/load50cpu_2_hour") -gt 0 ]]; then + log "已经存在CPU占用进程 !杀死该进程" + kill -9 $(ps -ef | grep -v "color" |grep "/octopus-agent/shell/function/load50cpu_2_hour" | awk '{print$2}') +fi + + log "开始执行CPU占用任务,占用时间为 2小时!" while [ $elapsed_time -lt 7200 ] do