examples/service/post-receive (816 bytes)
1 #!/bin/sh 2 # Git post-receive hook for the bare repo that holds your aicr source. 3 # Tells every other machine to pull and render right away, so `aicr watch 4 # --remote-every` polling is only a fallback. 5 # 6 # Install: copy to <bare repo>/hooks/post-receive, chmod +x, and list one SSH 7 # destination per line in <bare repo>/aicr-notify (for example user@laptop). 8 # Each machine needs a command that pulls and renders, for example: 9 # git -C ~/ai-config pull --ff-only -q && aicr render --source ~/ai-config 10 # Restrict the key with command="..." in that machine's authorized_keys. 11 hosts=$(dirname "$0")/../aicr-notify 12 [ -f "$hosts" ] || exit 0 13 while read -r host; do 14 case $host in '' | '#'*) continue ;; esac 15 ssh -o BatchMode=yes -o ConnectTimeout=5 "$host" aicr-pull </dev/null >/dev/null 2>&1 & 16 done <"$hosts" 17 exit 0