install.sh: expand @cfg_name@ in processed scripts
[girocco.git] / jobs / gitwebcache.sh
blob2bf638258edc52e8d7ca915d13fa67748d5a0d4b
1 #!/bin/sh
3 . @basedir@/shlib.sh
5 set -e
7 LOCK_FILE="/tmp/gitwebcache-$cfg_tmpsuffix.lock"
9 # Make sure we don't run twice.
10 if [ -s "$LOCK_FILE" ] && kill -0 "$(cat "$LOCK_FILE")" 2>/dev/null; then
11 echo "Already running gitwebcache.sh (stuck?) with pid $(cat "$LOCK_FILE")" >&2
12 exit 1
14 trap 'rm -f "$LOCK_FILE"' EXIT
15 trap 'exit 130' INT
16 trap 'exit 143' TERM
17 echo $$ >"$LOCK_FILE"
19 cd "$cfg_cgiroot"
21 # Re-generate the cache; we must be in same group as cgi user and
22 # $cache_grpshared must be 1.
23 # We get rid even of stderr since it's just junk from broken repos.
24 # We must set REQUEST_METHOD or gitweb.cgi will bail early
25 REQUEST_METHOD=HEAD && export REQUEST_METHOD
26 perl -e 'do "./gitweb.cgi"; END {
27 fill_project_list_info([], "rebuild-cache") }' >/dev/null 2>&1
29 rm -f "$LOCK_FILE"
30 trap - EXIT INT TERM