firstcommit

main
AhFei 2023-06-08 16:51:24 +08:00
parent 013808f5d7
commit c97f9b0227
1 changed files with 30 additions and 0 deletions

30
one-touch.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -ex
WORKSPACE=~/myserve/serverstatus
mkdir -p ${WORKSPACE}
cd ${WORKSPACE}
# 下载, arm 机器替换 x86_64 为 aarch64
OS_ARCH="x86_64"
latest_version=$(curl -m 10 -sL "https://api.github.com/repos/zdz/ServerStatus-Rust/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
wget --no-check-certificate -qO "server-${OS_ARCH}-unknown-linux-musl.zip" "https://github.com/zdz/ServerStatus-Rust/releases/download/${latest_version}/server-${OS_ARCH}-unknown-linux-musl.zip"
wget --no-check-certificate -qO "client-${OS_ARCH}-unknown-linux-musl.zip" "https://github.com/zdz/ServerStatus-Rust/releases/download/${latest_version}/client-${OS_ARCH}-unknown-linux-musl.zip"
unzip -o "server-${OS_ARCH}-unknown-linux-musl.zip"
unzip -o "client-${OS_ARCH}-unknown-linux-musl.zip"
# systemd service
mv -v stat_server.service /etc/systemd/system/stat_server.service
mv -v stat_client.service /etc/systemd/system/stat_client.service
systemctl daemon-reload
# 启动
systemctl start stat_server
systemctl start stat_client
# 状态查看
systemctl status stat_server
systemctl status stat_client