2026-02-23 21:26:48 +08:00
2026-02-22 20:55:05 +08:00
2026-02-23 21:26:48 +08:00
2026-02-22 20:55:05 +08:00
2026-02-23 21:26:48 +08:00
2026-02-23 21:26:48 +08:00
2026-02-22 20:55:05 +08:00
2026-02-22 20:55:05 +08:00
2026-02-23 21:26:48 +08:00
2026-02-22 20:55:05 +08:00

PT System Checking

上报硬盘剩余空间到 Uptime Kuma 实例,以 ping 作为空间剩余

部署

一键部署(推荐)

下载后运行(因为需要交互脚本):

wget https://gitea.service.jazzwhom.top/Passthem/pt-disk-report/raw/branch/main/install.sh
sudo bash install.sh

安装脚本会:

  1. 自动检测系统架构amd64/arm64
  2. 从 Gitea Releases 下载对应的二进制文件
  3. 交互式配置服务参数(服务器 URL、检查间隔、日志级别
  4. 安装并启动 systemd 服务

更新服务

curl -fsSL https://gitea.service.jazzwhom.top/Passthem/pt-disk-report/raw/branch/main/update.sh | sudo bash

或者下载后运行:

wget https://gitea.service.jazzwhom.top/Passthem/pt-disk-report/raw/branch/main/update.sh
sudo bash update.sh

卸载服务

sudo bash install.sh uninstall

本地构建与发布

安装交叉编译工具链

make install-targets

构建所有架构

make release

准备发布文件

make prepare-release

这会在 release/ 目录生成:

  • pt_system_checking-amd64 - x86_64 架构二进制文件
  • pt_system_checking-arm64 - ARM64 架构二进制文件(适用于香橙派 Zero3
  • install.sh - 一键部署脚本
  • update.sh - 一键更新脚本

发布 Gitea Release

make create-release VERSION=0.1.5

配置说明

服务支持以下配置项(通过环境变量):

  • PT__SERVER_URL - 服务器 URL用于上报磁盘状态
  • PT__INTERVAL - 检查间隔(秒,默认 300
  • PT__LOG_LEVEL - 日志级别trace/debug/info/warn/error默认 info

服务管理

安装后可使用以下命令管理服务:

# 查看服务状态
systemctl status pt_system_checking

# 查看实时日志
journalctl -u pt_system_checking -f

# 停止服务
systemctl stop pt_system_checking

# 启动服务
systemctl start pt_system_checking

# 重启服务
systemctl restart pt_system_checking

# 禁用开机自启
systemctl disable pt_system_checking

手动安装

如果不使用一键脚本,可以手动安装:

  1. 下载对应架构的二进制文件
  2. 复制到 /opt/pt_system_checking/
  3. 创建 systemd 服务文件 /etc/systemd/system/pt_system_checking.service
  4. 配置环境变量
  5. 启动服务:systemctl enable --now pt_system_checking

开发

运行测试

make test

清理构建文件

make clean
Description
给我的 Uptime Kuma 报告服务器硬盘状态的小应用
Readme 67 KiB
2026-02-23 21:26:16 +08:00
Languages
Shell 62.2%
Makefile 19.6%
Rust 18.2%