From 82a395dccfabc7b2d606502a840e0e6cc7e69e34 Mon Sep 17 00:00:00 2001 From: Erope Date: Sat, 7 May 2022 22:49:25 +0800 Subject: [PATCH] Add reinstall dashboard warning && Update README --- docs/UserGuide_en.md | 3 +-- docs/UserGuide_zh.md | 6 ++---- script/install.sh | 24 +++++++++++++++++++++++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/UserGuide_en.md b/docs/UserGuide_en.md index 0ecaf27..3262f36 100644 --- a/docs/UserGuide_en.md +++ b/docs/UserGuide_en.md @@ -5,8 +5,7 @@ **Recommended configuration:** Prepare _two domains_ before installation,a domain can **connect to CDN** for _Public Access_,for example (status.nai.ba). Another domain name resolves to the panel server allows the Agent can connect to the Dashboard,This domain **cannot connect to CDN** You need to make it expose the ip of the panel server directly. ```shell -curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh && chmod +x nezha.sh -sudo ./nezha.sh +curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh ``` _\* Use WatchTower to automatically update the panel, and in Windows you can use nssm to configure self-start_ diff --git a/docs/UserGuide_zh.md b/docs/UserGuide_zh.md index 7f60847..fde0801 100644 --- a/docs/UserGuide_zh.md +++ b/docs/UserGuide_zh.md @@ -13,15 +13,13 @@ **推荐配置:** 安装前准备 _两个域名_,一个可以 **接入 CDN** 作为 _公开访问_,比如 (status.nai.ba);另外一个解析到面板服务器作为 Agent 连接 Dashboard 使用,**不能接入 CDN** 直接暴露面板主机 IP,比如(ip-to-dashboard.nai.ba)。 ```shell -curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh -sudo ./nezha.sh +curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh ``` 国内镜像加速: ```shell -curl -L https://fastly.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh -CN=true sudo ./nezha.sh +curl -L https://fastly.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh ``` _\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动_ diff --git a/script/install.sh b/script/install.sh index 46d6436..daa4b58 100755 --- a/script/install.sh +++ b/script/install.sh @@ -141,7 +141,26 @@ install_dashboard() { echo -e "> 安装面板" # 哪吒监控文件夹 - mkdir -p $NZ_DASHBOARD_PATH + if [ ! -d "${NZ_DASHBOARD_PATH}" ]; then + mkdir -p $NZ_DASHBOARD_PATH + else + echo "您可能已经安装过面板端,重复安装会覆盖数据,请注意备份。" + read -e -r -p "是否退出安装? [Y/n] " input + case $input in + [yY][eE][sS] | [yY]) + echo "退出安装" + exit 0 + ;; + [nN][oO] | [nN]) + echo "继续安装" + ;; + *) + echo "退出安装" + exit 0 + ;; + esac + fi + chmod 777 -R $NZ_DASHBOARD_PATH command -v docker >/dev/null 2>&1 @@ -187,6 +206,9 @@ install_agent() { if [ ! -n "$version" ]; then version=$(curl -m 10 -sL "https://fastly.jsdelivr.net/gh/naiba/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/naiba\/nezha@/v/g') fi + if [ ! -n "$version" ]; then + version=$(curl -m 10 -sL "https://gcore.jsdelivr.net/gh/naiba/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/naiba\/nezha@/v/g') + fi if [ ! -n "$version" ]; then echo -e "获取版本号失败,请检查本机能否链接 https://api.github.com/repos/naiba/nezha/releases/latest"