[ agent ] [ agent ] - agent bootup optimize - 1
This commit is contained in:
@@ -558,6 +558,27 @@ EOF
|
||||
FunctionSuccess
|
||||
}
|
||||
|
||||
ChangeTimeZoneAndNTP() {
|
||||
FunctionStart
|
||||
colorEcho ${BLUE} "开始使用 timedatectl 工具进行时间同步…………"
|
||||
FunctionSuccess
|
||||
if [[ -n $(command -v timedatectl) ]]; then
|
||||
colorEcho ${BLUE} "检测到工具存在,正在设置时间和时区为 上海(UTC+8)时间"
|
||||
timedatectl set-timezone Asia/Shanghai && timedatectl set-ntp true
|
||||
colorEcho ${GREEN} "同步时间完成。现在时间为:"
|
||||
colorEcho ${GREEN} "--------------------------------------------------"
|
||||
colorEcho ${PURPLE} "$(date -R)"
|
||||
colorEcho ${GREEN} "--------------------------------------------------"
|
||||
colorEcho ${BLUE} "开始重启系统日志服务,使得系统日志的时间戳也立即生效"
|
||||
systemctl restart rsyslog
|
||||
colorEcho ${GREEN} "----------重启完成----------"
|
||||
else
|
||||
colorEcho ${RED} "timedatectl 工具不存在,时间同步失败!! 请手动更换时间!"
|
||||
fi
|
||||
FunctionSuccess
|
||||
FunctionEnd
|
||||
}
|
||||
|
||||
#######################################
|
||||
# description
|
||||
# Arguments:
|
||||
@@ -576,6 +597,8 @@ main() {
|
||||
|
||||
DownloadAllFile
|
||||
|
||||
ChangeTimeZoneAndNTP
|
||||
|
||||
BootUPAgent
|
||||
|
||||
InstallZSH "us"
|
||||
|
||||
@@ -11,14 +11,15 @@ FunctionStart
|
||||
|
||||
log "prepare the env"
|
||||
chmod +x /octopus-agent/shell/lib/wdd-lib-env.sh
|
||||
|
||||
/octopus-agent/shell/lib/wdd-lib-env.sh
|
||||
systemctl stop octopus-agent.service
|
||||
log "sleep for 5s waiting for agent shutdown !"
|
||||
sleep 5
|
||||
|
||||
log ""
|
||||
#systemctl stop octopus-agent.service
|
||||
#log "sleep for 5s waiting for agent shutdown !"
|
||||
#sleep 5
|
||||
|
||||
log "restart octopus agent ! $(date)"
|
||||
systemctl start octopus-agent.service
|
||||
systemctl restart octopus-agent.service
|
||||
|
||||
FunctionSuccess
|
||||
FunctionEnd
|
||||
|
||||
@@ -138,9 +138,6 @@ tmp () {
|
||||
gcloud compute instances create octopus-agent-2c-4g-1 --project=compact-lacing-371804 --zone=asia-northeast1-b --machine-type=n2d-custom-2-4096 --network-interface=network-tier=PREMIUM,subnet=default --metadata=startup-script=wget\ https://raw.githubusercontent.com/zeaslity/ProjectOctopus/main/source/src/main/java/io/wdd/source/shell/agent-bootup.sh\ \&\&\ chmod\ \+x\ agent-bootup.sh\ \&\&\ /bin/bash\ agent-bootup.sh --can-ip-forward --maintenance-policy=MIGRATE --provisioning-model=STANDARD --service-account=172889627951-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --create-disk=auto-delete=yes,boot=yes,device-name=octopus-agent-2c-4g,image=projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221213,mode=rw,size=20,type=projects/compact-lacing-371804/zones/us-west4-b/diskTypes/pd-ssd --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
|
||||
|
||||
|
||||
gcloud compute instances delete tokyo-amd64-03 --project=compact-lacing-371804 --zone=asia-northeast1-b
|
||||
|
||||
|
||||
gcloud compute instances create tokyo-amd64-03 --project=compact-lacing-371804 --zone=asia-northeast1-b --machine-type=n2d-custom-2-4096 --network-interface=network-tier=PREMIUM,subnet=default --can-ip-forward --maintenance-policy=MIGRATE --provisioning-model=STANDARD --service-account=172889627951-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --create-disk=auto-delete=yes,boot=yes,device-name=octopus-agent-2c-4g,image=projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221213,mode=rw,size=20,type=projects/compact-lacing-371804/zones/us-west4-b/diskTypes/pd-ssd --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
|
||||
|
||||
gcloud compute ssh --zone "asia-northeast1-b" "tokyo-amd64-03" --project "compact-lacing-371804"
|
||||
@@ -148,6 +145,11 @@ gcloud compute ssh --zone "asia-northeast1-b" "tokyo-amd64-03" --project "compac
|
||||
|
||||
wget https://raw.githubusercontent.com/zeaslity/ProjectOctopus/main/source/src/main/java/io/wdd/source/shell/agent-bootup.sh && chmod +x agent-bootup.sh && /bin/bash agent-bootup.sh
|
||||
|
||||
|
||||
echo "y
|
||||
" | gcloud compute instances delete tokyo-amd64-03 --project=compact-lacing-371804 --zone=asia-northeast1-b
|
||||
|
||||
|
||||
apt-cache madison openjdk-11-jdk | head -n 1 | awk '{print$3}'
|
||||
|
||||
java -jar /octopus-agent/agent.jar -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
|
||||
|
||||
Reference in New Issue
Block a user