smart_ide/scripts/install-git-pull-systemd-user.sh
Nicolas Cantu d98e6bce60 feat: logs/ for pull-sync and ia_dev; document ia_dev as in-repo module
- Default PULL_SYNC_LOG to logs/git-pull-projects.log; add logs/README and gitignore
- Add services/ia_dev integration README and .env.example
- Replace docs/ia_dev-submodule.md with ia_dev-module.md; update ecosystem and README links
- Point ia_dev submodule to commit with smart_ide_logs.sh
2026-04-03 17:50:49 +02:00

28 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Installe le timer systemd utilisateur pour git-pull (config centralisée : cron/config.env).
# Usage : ./scripts/install-git-pull-systemd-user.sh
# Puis : systemctl --user status git-pull-project-clones.timer
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
SERVICE_IN="${ROOT}/systemd/user/git-pull-project-clones.service.in"
TIMER_SRC="${ROOT}/systemd/user/git-pull-project-clones.timer"
SERVICE_OUT="${UNIT_DIR}/git-pull-project-clones.service"
TIMER_OUT="${UNIT_DIR}/git-pull-project-clones.timer"
mkdir -p "$UNIT_DIR"
sed "s|@SMART_IDE_ROOT@|$ROOT|g" "$SERVICE_IN" >"$SERVICE_OUT"
cp -f "$TIMER_SRC" "$TIMER_OUT"
chmod 0644 "$SERVICE_OUT" "$TIMER_OUT"
chmod +x "${ROOT}/cron/git-pull-wrapper.sh" "${ROOT}/cron/git-pull-project-clones.sh"
systemctl --user daemon-reload
systemctl --user enable git-pull-project-clones.timer
systemctl --user start git-pull-project-clones.timer
echo "Installé : $SERVICE_OUT"
echo "Timer : $(systemctl --user is-active git-pull-project-clones.timer) (next: $(systemctl --user list-timers git-pull-project-clones.timer --no-legend 2>/dev/null | awk '{print $1,$2}' || true))"
echo "Config : $ROOT/cron/config.env (+ optionnel cron/config.local.env)"
echo "Logs : voir PULL_SYNC_LOG dans config.env (défaut <racine smart_ide>/logs/git-pull-projects.log)"