[server] - 修改bug

This commit is contained in:
zeaslity
2023-02-16 16:31:09 +08:00
parent e630b291e3
commit 30caa38e71
3 changed files with 41 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ public class AgentOperationInfoService {
// 需要此部分写为String, 否则无法解析 // 需要此部分写为String, 否则无法解析
String agentServerInfoString; String agentServerInfoString;
try { try {
agentServerInfoString = objectMapper.writeValueAsString(objectMapper); agentServerInfoString = objectMapper.writeValueAsString(agentServerInfo);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@@ -55,7 +55,7 @@ public class OctopusMessageHandler {
} }
// Octopus Message Handler // Octopus Message Handler
log.info( log.debug(
"received from agent : {} ", "received from agent : {} ",
octopusMessage octopusMessage
); );

View File

@@ -2,7 +2,7 @@
##### environment variables ###### ##### environment variables ######
JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=utf-8 --spring.profiles.active=k3s --spring.cloud.nacos.config.group=k3s --spring.cloud.nacos.config.extension-configs[0].dataId=common-k3s.yaml --spring.cloud.nacos.config.extension-configs[0].group=k3s" JAVA_OPTS="-Xms128m -Xmx512m -Ddebug=false -Dfile.encoding=utf-8 --spring.profiles.active=k3s --spring.cloud.nacos.config.group=k3s --spring.cloud.nacos.config.extension-configs[0].dataId=common-k3s.yaml --spring.cloud.nacos.config.extension-configs[0].group=k3s"
DependLibFiles=( DependLibFiles=(
wdd-lib-file.sh wdd-lib-file.sh
@@ -341,6 +341,7 @@ InstallJDKPackage() {
systemdAgent() { systemdAgent() {
# https://www.baeldung.com/linux/run-java-application-as-service # https://www.baeldung.com/linux/run-java-application-as-service
colorEcho $BLUE "[守护]-开始设置Agent的守护进程"
cat >/etc/systemd/system/octopus-agent.service <<EOF cat >/etc/systemd/system/octopus-agent.service <<EOF
[Unit] [Unit]
@@ -563,6 +564,16 @@ EOF
FunctionSuccess FunctionSuccess
} }
#######################################
# description
# Globals:
# BLUE
# GREEN
# PURPLE
# RED
# Arguments:
# None
#######################################
ChangeTimeZoneAndNTP() { ChangeTimeZoneAndNTP() {
FunctionStart FunctionStart
colorEcho ${BLUE} "开始使用 timedatectl 工具进行时间同步…………" colorEcho ${BLUE} "开始使用 timedatectl 工具进行时间同步…………"
@@ -584,6 +595,31 @@ ChangeTimeZoneAndNTP() {
FunctionEnd FunctionEnd
} }
#######################################
# description
# Arguments:
# None
#######################################
CleanOldOctopusAgent() {
FunctionStart
colorEcho $BLUE "start to kill old octopus-agent"
agentPid=$(ps -ef | grep -v "color="| grep -c "octopus-agent")
if [[ $agentPid -gt 0 ]]; then
colorEcho $BLUE "old agent existed ! start to kill"
systemctl stop octopus-agent
sleep 2
systemctl disable octopus-agent
rm -rf /etc/systemd/system/octopus-agent.service
fi
FunctionSuccess
FunctionEnd
}
####################################### #######################################
# description # description
# Arguments: # Arguments:
@@ -600,6 +636,8 @@ main() {
InstallJDKPackage 11 InstallJDKPackage 11
CleanOldOctopusAgent
DownloadAllFile DownloadAllFile
ChangeTimeZoneAndNTP ChangeTimeZoneAndNTP