[ Agent ] [ Executor ] - agent启动脚本

This commit is contained in:
zeaslity
2023-10-24 10:14:39 +08:00
parent 33a64d896a
commit 5e23519ff5
2 changed files with 8 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
#!/bin/bash #!/bin/bash
OctopusAgentUrl=https://happybirthday.107421.xyz/octopus-agent/ OctopusAgentUrl=https://happybirthday.107421.xyz/octopus-agent/
OctopusAgentShell=https://happybirthday.107421.xyz/octopus-agent/shell
AgentConfigUrl=https://happybirthday.107421.xyz/agent-config/ AgentConfigUrl=https://happybirthday.107421.xyz/agent-config/
OctopusAgentPath=/octopus-agent/shell OctopusAgentPath=/octopus-agent/shell
##### environment variables ###### ##### environment variables ######
@@ -25,7 +26,7 @@ SplitLine="----------------------" #会被sys函数中的方法重写
######## 颜色函数方法很精妙 ############ ######## 颜色函数方法很精妙 ############
colorEcho() { colorEcho() {
echo -e "\033[${1}${@:2}\033[0m" 1>&2 echo -e "\033[${1}${*:2}\033[0m" 1>&2
} }
####################################### #######################################
@@ -183,7 +184,7 @@ check_sys() {
## 安装所需要的程序,及依赖程序 ## 安装所需要的程序,及依赖程序
installDemandSoftwares() { installDemandSoftwares() {
for software in $@; do for software in "$@"; do
## 安装该软件 ## 安装该软件
if [[ -n $(command -v ${software}) ]]; then if [[ -n $(command -v ${software}) ]]; then
colorEcho ${GREEN} "${software}已经安装了...跳过..." colorEcho ${GREEN} "${software}已经安装了...跳过..."
@@ -348,10 +349,10 @@ CommonToolInstall() {
echo "" echo ""
if [[ ${LinuxReleaseVersion} == "centos" ]]; then if [[ ${LinuxReleaseVersion} == "centos" ]]; then
centosCommonTool=(deltarpm net-tools iputils bind-utils lsof curl wget vim mtr htop) centosCommonTool=(deltarpm net-tools iputils bind-utils lsof curl wget vim mtr htop)
installDemandSoftwares ${centosCommonTool[@]} installDemandSoftwares "${centosCommonTool[@]}"
elif [[ ${LinuxReleaseVersion} == "ubuntu" ]] || [[ ${LinuxReleaseVersion} == "debian" ]]; then elif [[ ${LinuxReleaseVersion} == "ubuntu" ]] || [[ ${LinuxReleaseVersion} == "debian" ]]; then
ubuntuCommonTool=(iputils-ping net-tools dnsutils lsof curl wget mtr-tiny vim htop lrzsz) ubuntuCommonTool=(iputils-ping net-tools dnsutils lsof curl wget mtr-tiny vim htop lrzsz)
installDemandSoftwares ${ubuntuCommonTool[@]} installDemandSoftwares "${ubuntuCommonTool[@]}"
fi fi
FunctionEnd FunctionEnd
} }
@@ -369,8 +370,9 @@ BootUPAgent() {
FunctionStart FunctionStart
colorEcho $BLUE "开始配置Agent启动的基础环境信息" colorEcho $BLUE "开始配置Agent启动的基础环境信息"
chmod +x $OctopusAgentPath/lib/wdd-lib-env.sh wget ${OctopusAgentShell}/octopus-env.sh -qO $OctopusAgentPath/lib/octopus-env.sh
$OctopusAgentPath/lib/wdd-lib-env.sh chmod +x $OctopusAgentPath/lib/octopus-env.sh
$OctopusAgentPath/lib/octopus-env.sh
colorEcho $BLUE "start to daemon the octopus agent" colorEcho $BLUE "start to daemon the octopus agent"
systemdAgent systemdAgent