update.sh: Send only single failure/recovery mails
[girocco/radio.git] / updatecheck.sh
blob1b30faa2133c7e12c8eccd1304d5101a72ee2ff7
1 #!/bin/bash
3 export PATH=/home/pasky/bin:$PATH
5 if [ -e /tmp/gitupdatelock ]; then
6 echo "Locked!" >&2
7 exit 1
8 fi
9 touch /tmp/gitupdatelock
11 # Repack in reverse order, so that forked repositories get repacked first.
12 # That prevents objects from missing, since repack -l will automagically
13 # put the now-going-away objects into the forked repository's object store.
15 cd /srv/git
16 find . -name base_url | cut -c 3- | sed -e 's/\/base_url$//' | tac |
17 while read dir; do
18 if [ -e "$dir"/.nofetch ]; then
19 # echo "+l `date` $dir"
20 (cd "$dir/objects" && [ "$(ls ?? 2>/dev/null)" ] && GIT_DIR=".." git repack -a -l -d -q)
21 GIT_DIR="$dir" git update-server-info
22 # echo "-l `date` $dir"
23 else
24 # echo "+r `date` $dir"
25 /home/repo/repomgr/update.sh "${dir%.git}"
26 # echo "-r `date` $dir"
28 done 2>&1 | grep -v '^Pack.*created\.$'
30 rm /tmp/gitupdatelock