Mercurial > archived > louis > tools > gitgc_cron
changeset 0:7a19fa9c3735 default tip
- Initial import
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Thu, 07 Jan 2010 16:49:38 +0100 |
parents | |
children | |
files | gitgc |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gitgc Thu Jan 07 16:49:38 2010 +0100 @@ -0,0 +1,25 @@ +#!/bin/sh + +# This script assume that you have your bare repositories below this directory : +REPOS_ROOT=/var/git/ + +error() +{ + echo "git-gc: error: $1." +} + +run() +{ + if [ -d "$REPOS_ROOT" ] ; then + find "$REPOS_ROOT" -mindepth 1 -maxdepth 1 -type d -print0 | + xargs -0 -Ipath su www-data -c "git --git-dir='path' gc" + return 0 + fi + + error "$REPOS_ROOT doesn't exists" + return 1 +} + +run + +exit $?