Add timeout limit for wget

This commit is contained in:
Erope
2022-05-30 18:49:10 +08:00
parent 7ab0dfdf83
commit 79ed83f6f1
3 changed files with 13 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
NZ_VERSION="v0.10.5"
NZ_VERSION="v0.10.6"
red='\033[0;31m'
green='\033[0;32m'
@@ -149,7 +149,7 @@ install_dashboard() {
command -v docker-compose >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "Installing Docker Compose"
wget -t 2 -O /usr/local/bin/docker-compose "https://${GITHUB_URL}/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" >/dev/null 2>&1
wget -t 2 -T 10 -O /usr/local/bin/docker-compose "https://${GITHUB_URL}/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "${red}Script failed to get, please check if the network can link ${GITHUB_URL}${plain}"
return 0
@@ -204,7 +204,7 @@ install_agent() {
chmod 777 -R $NZ_AGENT_PATH
echo -e "Downloading Agent"
wget -t 2 -O nezha-agent_linux_${os_arch}.zip https://${GITHUB_URL}/naiba/nezha/releases/download/${version}/nezha-agent_linux_${os_arch}.zip >/dev/null 2>&1
wget -t 2 -T 10 -O nezha-agent_linux_${os_arch}.zip https://${GITHUB_URL}/naiba/nezha/releases/download/${version}/nezha-agent_linux_${os_arch}.zip >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "${red}Fail to download agent, please check if the network can link ${GITHUB_URL}${plain}"
return 0
@@ -228,7 +228,7 @@ install_agent() {
modify_agent_config() {
echo -e "> Modify Agent Configuration"
wget -t 2 -O $NZ_AGENT_SERVICE https://${GITHUB_RAW_URL}/script/nezha-agent.service >/dev/null 2>&1
wget -t 2 -T 10 -O $NZ_AGENT_SERVICE https://${GITHUB_RAW_URL}/script/nezha-agent.service >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "${red}Fail to download service, please check if the network can link ${GITHUB_RAW_URL}${plain}"
return 0
@@ -278,13 +278,13 @@ modify_dashboard_config() {
echo -e "> Modify Panel Configuration"
echo -e "Download Docker Script"
wget -t 2 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
wget -t 2 -T 10 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "${red}Script failed to get, please check if the network can link ${GITHUB_RAW_URL}${plain}"
return 0
fi
wget -t 2 -O /tmp/nezha-config.yaml https://${GITHUB_RAW_URL}/script/config.yaml >/dev/null 2>&1
wget -t 2 -T 10 -O /tmp/nezha-config.yaml https://${GITHUB_RAW_URL}/script/config.yaml >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "${red}Script failed to get, please check if the network can link ${GITHUB_RAW_URL}${plain}"
return 0