Merge branch 'master' into rorcz
[girocco.git] / jobs / gitwebcache.sh
blob8254cf53324029c5548832b66ee2ef61156a1115
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 set -e
7 LOCK_DIR=/tmp/gitweb
8 LOCK_FILE=${LOCK_DIR}/lock
10 # Make sure the directory exists
11 mkdir -p ${LOCK_DIR}
13 # Make sure we don't run twice.
14 if [ -s ${LOCK_FILE} ] && kill -0 $(cat ${LOCK_FILE}); then
15 echo "Already running (stuck?) with pid $(cat ${LOCK_FILE})" >&2
16 exit 1
18 echo $$ >${LOCK_FILE}
20 cd "$cfg_cgiroot"
22 # Re-generate the cache; we must be in same group as cgi user and
23 # $cache_grpshared must be 1.
24 # We get rid even of stderr since it's just junk from broken repos.
25 perl -le 'require("./gitweb.cgi"); END { my @list = git_get_projects_list(); cached_project_list_info(\@list, 1, 1, 1); }' >/dev/null 2>&1
27 rm ${LOCK_FILE}