10 Commits

Author SHA1 Message Date
af970a77ed 降低python版本依赖 2024-10-03 00:59:49 +08:00
a579c76002 添加命令行工具 2024-10-03 00:27:39 +08:00
66d0782106 添加命令行工具 2024-10-03 00:24:53 +08:00
851242ce51 添加命令行工具 2024-10-03 00:22:04 +08:00
703fe75a76 添加注释 2024-10-03 00:17:56 +08:00
d24926daeb 添加注释 2024-10-03 00:14:08 +08:00
80ee613746 添加注释 2024-10-03 00:13:57 +08:00
851d1b0b7f 添加注释 2024-10-02 23:03:54 +08:00
f12858a876 添加注释 2024-10-02 23:03:19 +08:00
a0c84037e8 添加注释 2024-10-02 23:02:24 +08:00
3 changed files with 23 additions and 11 deletions

View File

@@ -32,16 +32,16 @@ _✨ 服务器状态 - 客户端 ✨_
Debian系请使用pipx安装
```bash
sudo apt install python3-pipx
pipx install server-status
sudo apt install pipx
sudo pipx install server-status
```
## 🎉 使用
### 命令
- `server_status <server> <token> <id> run` - 运行客户端
- `server_status <server> <token> <id> rm` - 从服务端移除主机
- `server-status <server> <token> <id> run` - 运行客户端
- `server-status <server> <token> <id> rm` - 从服务端移除主机
#### 可选项
- `-n|--name` - 设置主机名称
@@ -60,6 +60,8 @@ server_status https://status.liteyuki.icu 114514 myhost run -n "MyHost" --labels
### 开机启动
执行以下命令
```shell
sudo pipx ensurepath # 确保pipx路径在环境变量下
sudo touch /etc/systemd/system/server-status-client.service
sudo bash -c 'cat <<EOF > /etc/systemd/system/server-status-client.service
@@ -69,7 +71,7 @@ After=network-online.target
[Service]
Type=simple
ExecStart=sudo server_status <server> <token> <id> run # 请替换为实际参数
ExecStart=server-status <server> <token> <id> run # 请替换为实际参数
Restart=on-failure
RestartSec=10
@@ -80,3 +82,7 @@ EOF'
sudo systemctl enable server-status-client
sudo systemctl start server-status-client
```
### 服务端
请在中心服务器上部署 [server-status-server](https://github.com/snowykami/server-status-server)

View File

@@ -3,21 +3,23 @@ name = "server-status"
dynamic = ["version"]
description = "Server status client"
authors = [
{name = "snowykami", email = "snowykami@outlook.com"},
{ name = "snowykami", email = "snowykami@outlook.com" },
]
dependencies = [
"requests>=2.32.3",
"psutil>=6.0.0",
"arclet-alconna>=1.8.30",
]
requires-python = ">=3.11"
requires-python = ">=3.10"
readme = "README.md"
license = {text = "MIT"}
license = { text = "MIT" }
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
[project.scripts]
server-status = "server_status.__main__:main"
[tool.pdm]
distribution = true

View File

@@ -1,10 +1,10 @@
import socket
import sys
from server_status.api import *
from server_status.cmd_parser import server_status_alc
if __name__ == "__main__":
def main():
raw_msg = "server_status " + " ".join(sys.argv[1:])
arp = server_status_alc.parse(raw_msg)
@@ -35,3 +35,7 @@ if __name__ == "__main__":
else:
log("Unknown command, use 'server_status --help' for help/未知命令或参数错误,请使用 'server_status --help' 获取帮助")
if __name__ == "__main__":
main()