From fb7e3144d39791b9c54b1befeb0aa6811428eaaa Mon Sep 17 00:00:00 2001 From: snowykami Date: Sat, 5 Oct 2024 21:57:48 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BF=AE=E5=A4=8D=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=89=A7=E8=A1=8C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- deploy.sh | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 73b8ad2..e965025 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ _✨ 服务器状态 - 客户端 ✨_ - Linux 可使用脚本安装,带自动部署和自启动 ```shell -curl -sSL https://raw.githubusercontent.com/snowykami/server-status-client/refs/heads/main/deploy.sh | sudo bash +curl -sSL https://raw.githubusercontent.com/snowykami/server-status-client/refs/heads/main/deploy.sh -o /tmp/deploy.sh && sudo bash /tmp/deploy.sh && rm /tmp/deploy.sh ``` - 或手动部署 diff --git a/deploy.sh b/deploy.sh index 1fac234..6a3fe0c 100755 --- a/deploy.sh +++ b/deploy.sh @@ -65,7 +65,7 @@ fi echo "venv created successfully" # activate the virtual environment - +source "$python_exe" # install the required packages echo "Installing the required packages" @@ -79,24 +79,24 @@ echo "Creating the systemd service" # shellcheck disable=SC2002 id=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) -#bash -c "cat < /etc/systemd/system/server-status-client.service -#[Unit] -#Description=Server Status Client -#After=network-online.target -# -#[Service] -#Type=simple -#ExecStart=$install_dir/server-status-client/venv/bin/python main.py $server $token $id run -n $hostname --labels $labels --location $location -#WorkingDirectory=$install_dir/server-status-client -#Restart=on-failure -#RestartSec=10 -# -#[Install] -#WantedBy=multi-user.target -#EOF" +bash -c "cat < /etc/systemd/system/server-status-client.service +[Unit] +Description=Server Status Client +After=network-online.target + +[Service] +Type=simple +ExecStart=$install_dir/server-status-client/venv/bin/python main.py $server $token $id run -n $hostname --labels $labels --location $location +WorkingDirectory=$install_dir/server-status-client +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF" # enable and start the service systemctl enable server-status-client systemctl start server-status-client -echo "server-status-client installed successfully" +echo "server-status-client installed successfully" \ No newline at end of file