Resume timer after pause

This commit is contained in:
Ankle committed 2026-07-15 13:58:32 +08:00
1 parent 7e0d562d9f
commit cf920dc76f
7 files changed
+110 -11

No files matched your search

+10 -6
View File
@@ -1,6 +1,6 @@
# cleanup-smartcam-data 部署说明
![cleanup-smartcam-data 自动清理策略](assets/cleanup-smartcam-data-flow.png)
![cleanup-smartcam-data 自动清理策略](assets/cleanup-smartcam-data-flow.svg)
## 文件结构
@@ -8,11 +8,13 @@
cleanup-smartcam-data/
├── README.md
├── assets/
│ └── cleanup-smartcam-data-flow.png
│ ├── cleanup-smartcam-data-flow.svg
│ └── cleanup-smartcam-data-flow.png(旧版兼容文件)
├── bin/
│ └── cleanup-smartcam-data
├── systemd/
│ ├── cleanup-smartcam-data.service
│ ├── cleanup-smartcam-data-resume.timer
│ └── cleanup-smartcam-data.timer
└── scripts/
├── install.sh
@@ -26,6 +28,7 @@ cleanup-smartcam-data/
| `bin/cleanup-smartcam-data` | `/usr/local/sbin/cleanup-smartcam-data` |
| `systemd/cleanup-smartcam-data.service` | `/etc/systemd/system/cleanup-smartcam-data.service` |
| `systemd/cleanup-smartcam-data.timer` | `/etc/systemd/system/cleanup-smartcam-data.timer` |
| `systemd/cleanup-smartcam-data-resume.timer` | `/etc/systemd/system/cleanup-smartcam-data-resume.timer` |
运行状态目录由程序自动创建:
@@ -69,7 +72,7 @@ sudo ./scripts/install.sh
- 开机2分钟后首次检查;
- 之后每60分钟检查一次;
- `/userdata` 低于15GiB时开始安全清理;
- `/userdata` 空闲低于10GiB时开始安全清理;
- 只清理 `processed_files.log` 中确认成功、且超过60分钟的数据;
- 同时删除同一任务的:
@@ -80,9 +83,10 @@ sudo ./scripts/install.sh
```
- 超过60分钟的0字节 raw,如果未被进程占用,也会按上述三件套删除;
- 低于8GiB时暂停采集,Producer继续上传;
- 恢复到15GiB后自动恢复采集;
- 低于5GiB时输出 CRITICAL 告警;
- 空闲低于5GiB时暂停采集,Producer继续上传;
- 暂停期间每2分钟检查一次;
- 空闲恢复到10GiB后自动恢复采集,并停止2分钟检查;
- 空闲低于3GiB时输出 CRITICAL 告警;
- 无法读取成功记录时不删除数据。
## 验证