6 Commits

Author SHA1 Message Date
803f742d85 降低python版本依赖 2024-10-03 01:48:18 +08:00
2e0c8ff194 降低python版本依赖 2024-10-03 01:47:38 +08:00
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
4 changed files with 63 additions and 8 deletions

49
.github/workflows/nuitka-compile.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
arch: [amd64, arm64, arm, 386]
runs-on: ${{ matrix.os }}
steps:
- name: Check-out repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install Dependencies
run: |
pip install pdm
pdm install --no-lock
- name: Build Executable
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: server_status.__main__
onefile: true
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }} Build
path: |
build/*.exe
build/*.bin
build/*.app/**/*

View File

@@ -33,15 +33,15 @@ Debian系请使用pipx安装
```bash
sudo apt install pipx
pipx install server-status
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

View File

@@ -10,7 +10,7 @@ dependencies = [
"psutil>=6.0.0",
"arclet-alconna>=1.8.30",
]
requires-python = ">=3.11"
requires-python = ">=3.10"
readme = "README.md"
license = { text = "MIT" }
@@ -19,7 +19,7 @@ requires = ["pdm-backend"]
build-backend = "pdm.backend"
[project.scripts]
server-status = "server_status.__main__"
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()