mirroring/*, jobs/gc.sh: daemons/*
[girocco/mytab.git] / daemons / repod.sh
blob97b440efd29e671e3cec34dbe1e26584f23e28f9
1 #!/bin/bash
3 # repod - Perform Girocco maintenance jobs
5 # repod is Girocco repositories maintenance servant; it periodically
6 # checks all the repositories and updates mirrored repositories and
7 # repacks push-repositories when needed.
9 . @basedir@/shlib.sh
11 # Lock setup
13 if [ -e /tmp/repod.lock ]; then
14 echo "Locked! Stale /tmp/repod.lock?" >&2
15 exit 1
17 echo $$ >/tmp/repod.lock
18 trap "rm /tmp/repod.lock" SIGINT SIGTERM EXIT
21 ## Single-project routine
23 check_one_proj()
25 proj="$1"
26 if [ ! -e "$proj.git"/.nofetch ]; then
27 "$cfg_basedir"/daemons/update.sh "$proj"
29 "$cfg_basedir"/jobs/gc.sh "$proj" 2>&1 | grep -v '^Pack.*created\.$'
33 ## Main loop body
35 check_all_projects()
37 get_repo_list | while read proj; do
38 check_one_proj "$proj"
39 done
43 ## Main program
45 while true; do
46 check_all_projects
47 sleep 10
48 done