From 2d048f727c1a5acc65dfb70604139e45596b5cba Mon Sep 17 00:00:00 2001 From: Florian Egger Date: Mon, 14 Sep 2026 14:56:04 +0200 Subject: [PATCH] Document automatic sync via systemd timer --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 6538134..08c09dd 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,23 @@ export TIME_TRACK_DEVICE_ID="laptop-2026" Only finished entries are sent. Each completed entry receives a stable UUID. On first load after upgrading, historic entries are assigned UUIDs and the local data file is updated, so repeating a sync submits the same entry IDs for server-side idempotency. The active session is never uploaded. +### Automatic sync (systemd user timer) + +A systemd user pair can run `sync` on a schedule: + +- `time-track-sync.service` (oneshot; reads `%h/.config/time-track-sync/env` and runs `time_track.py sync`) +- `time-track-sync.timer` (every 15 minutes, `Persistent=true` to catch up after sleep) + +The env file holds the same three variables as above, with mode 600. Because the client re-sends all finished entries and the server dedupes by entry UUID, resending is safe; a race with a concurrently toggling tracker can at worst skip one cycle. The timer does not upload the active session. + +Useful commands: + +```sh +systemctl --user start time-track-sync.service # run a sync now +systemctl --user list-timers time-track-sync.timer # next scheduled run +journalctl --user -u time-track-sync.service -f # live logs +``` + ## Waybar behavior - **Left click**: start or stop a session.