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

+13
View File
@@ -33,9 +33,21 @@ install -o root -g root -m 0644 \
"$ROOT_DIR/systemd/cleanup-smartcam-data.timer" \
/etc/systemd/system/cleanup-smartcam-data.timer
install -o root -g root -m 0644 \
"$ROOT_DIR/systemd/cleanup-smartcam-data-resume.timer" \
/etc/systemd/system/cleanup-smartcam-data-resume.timer
systemctl daemon-reload
systemctl enable --now cleanup-smartcam-data.timer
# The fast timer is started by the cleanup program only while capture is paused.
systemctl disable cleanup-smartcam-data-resume.timer 2>/dev/null || true
if [[ -f /var/lib/cleanup-smartcam-data/capture-paused ]]; then
systemctl start cleanup-smartcam-data-resume.timer
else
systemctl stop cleanup-smartcam-data-resume.timer 2>/dev/null || true
fi
# Remove obsolete installed names only after the new timer is active.
rm -f \
/etc/systemd/system/userdata-video-cleanup.timer \
@@ -47,4 +59,5 @@ echo "安装完成。"
echo "程序: /usr/local/sbin/cleanup-smartcam-data"
echo "服务: /etc/systemd/system/cleanup-smartcam-data.service"
echo "定时器: /etc/systemd/system/cleanup-smartcam-data.timer"
echo "暂停恢复定时器: /etc/systemd/system/cleanup-smartcam-data-resume.timer"
systemctl --no-pager status cleanup-smartcam-data.timer || true