From 95ff8779dba5cb7750acea6304544370c47b4039 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 22:54:14 +0000 Subject: [PATCH] Replace cron suggestion with systemd timer for kiwix updates User units in systemd/ with an install.sh that symlinks and enables. Persistent=true means missed runs (machine off) catch up on next boot. Logs via journald: journalctl --user -u kiwix-update.service https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx --- systemd/install.sh | 19 +++++++++++++++++++ systemd/kiwix-update.service | 10 ++++++++++ systemd/kiwix-update.timer | 11 +++++++++++ 3 files changed, 40 insertions(+) create mode 100755 systemd/install.sh create mode 100644 systemd/kiwix-update.service create mode 100644 systemd/kiwix-update.timer diff --git a/systemd/install.sh b/systemd/install.sh new file mode 100755 index 0000000..ef27985 --- /dev/null +++ b/systemd/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Install kiwix-update systemd user units and enable the timer +set -e + +UNIT_DIR="$HOME/.config/systemd/user" +SRC="$(cd "$(dirname "$0")" && pwd)" + +mkdir -p "$UNIT_DIR" +ln -sf "$SRC/kiwix-update.service" "$UNIT_DIR/kiwix-update.service" +ln -sf "$SRC/kiwix-update.timer" "$UNIT_DIR/kiwix-update.timer" + +systemctl --user daemon-reload +systemctl --user enable --now kiwix-update.timer + +echo "" +systemctl --user list-timers kiwix-update.timer +echo "" +echo "Run manually anytime: systemctl --user start kiwix-update.service" +echo "Logs: journalctl --user -u kiwix-update.service" diff --git a/systemd/kiwix-update.service b/systemd/kiwix-update.service new file mode 100644 index 0000000..3ac3091 --- /dev/null +++ b/systemd/kiwix-update.service @@ -0,0 +1,10 @@ +[Unit] +Description=Kiwix ZIM auto-updater +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +ExecStart=/bin/bash %h/local-ai/kiwix_update.sh +StandardOutput=journal +StandardError=journal diff --git a/systemd/kiwix-update.timer b/systemd/kiwix-update.timer new file mode 100644 index 0000000..05df2d5 --- /dev/null +++ b/systemd/kiwix-update.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Monthly Kiwix ZIM update check +Requires=kiwix-update.service + +[Timer] +OnCalendar=monthly +RandomizedDelaySec=1h +Persistent=true + +[Install] +WantedBy=timers.target