Add Ollama model auto-updater with systemd timer

ollama pull compares digests server-side so no download happens if
a model is already current. Timer runs monthly offset 2h from kiwix.
install.sh updated to handle all units generically.

https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx
This commit is contained in:
Claude
2026-03-21 23:09:18 +00:00
parent 95ff8779db
commit 83d8406d1a
4 changed files with 109 additions and 7 deletions
+21 -7
View File
@@ -1,19 +1,33 @@
#!/bin/bash
# Install kiwix-update systemd user units and enable the timer
# Install all local-ai systemd user units and enable timers
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"
for unit in "$SRC"/*.service "$SRC"/*.timer; do
name=$(basename "$unit")
ln -sf "$unit" "$UNIT_DIR/$name"
echo "Linked $name"
done
systemctl --user daemon-reload
systemctl --user enable --now kiwix-update.timer
for timer in "$SRC"/*.timer; do
name=$(basename "$timer")
systemctl --user enable --now "$name"
echo "Enabled $name"
done
echo ""
systemctl --user list-timers kiwix-update.timer
systemctl --user list-timers kiwix-update.timer ollama-update.timer
echo ""
echo "Run manually anytime: systemctl --user start kiwix-update.service"
echo "Logs: journalctl --user -u kiwix-update.service"
echo "Run manually:"
echo " systemctl --user start kiwix-update.service"
echo " systemctl --user start ollama-update.service"
echo ""
echo "Logs:"
echo " journalctl --user -u kiwix-update.service -f"
echo " journalctl --user -u ollama-update.service -f"