aboutsummaryrefslogtreecommitdiff
path: root/mirror_cleaner.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mirror_cleaner.sh')
-rwxr-xr-xmirror_cleaner.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/mirror_cleaner.sh b/mirror_cleaner.sh
new file mode 100755
index 0000000..8c91ed2
--- /dev/null
+++ b/mirror_cleaner.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+BASE=/srv/mirror/gerrit-mirror
+
+umask 022
+
+# silence pushd/popd
+pushd () {
+ command pushd "$@" > /dev/null
+}
+
+popd () {
+ command popd "$@" > /dev/null
+}
+
+for repo in $(find $BASE -type d -name "*.git");
+do
+ echo "----- $repo"
+ pushd $repo
+ if [ -f gc.log ];
+ then
+ echo "WARNING: found ${repo}/gc.log"
+ cat ${repo}/gc.log
+ rm -f ${repo}/gc.log
+ fi
+
+ git reflog expire --expire=now --all
+ ionice -c2 -n7 -- git gc --prune=now --aggressive >/dev/null
+done