daemons/repod.sh: Introduce, invokes update.sh and gc.sh in infinite loop
[girocco.git] / daemons / repod.sh
blobb49fc4ad9401312c1e977f900aba5b7a3d3f1ae1
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"/mirroring/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