From: Holger Levsen Date: Fri, 14 Sep 2012 10:49:40 +0000 (+0200) Subject: implement basic garbage collection, not yet activated X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=880df0ce4ef3a09f44a2363630d383ba7be4faa7;p=profitbricks%2Fjenkins-build-scripts.git implement basic garbage collection, not yet activated --- diff --git a/liveboot_build.sh b/liveboot_build.sh index 944d513..4bcdf56 100755 --- a/liveboot_build.sh +++ b/liveboot_build.sh @@ -15,7 +15,6 @@ export PB_SUITE=production-proposed-updates RSYNC_SRC=/srv/mirror/liveboot RSYNC_FILTER='' -# TODO: WORK IN PROGRESS # ri server RSYNC_DST1="liveboot@riserver/liveboot/" # storage DC (mgmt11) @@ -24,6 +23,7 @@ RSYNC_DST2="liveboot@10.251.1.1/liveboot/" RSYNC_DST3="liveboot@10.254.1.1/liveboot/" # staging (mgmt9) RSYNC_DST4="liveboot@10.252.1.1/liveboot/" +# TODO: DC1 + DC2 BUILD_SCRIPT=$(mktemp) cat > $BUILD_SCRIPT <<-EOF @@ -43,6 +43,22 @@ sudo mv *-* /srv/mirror/liveboot cd /srv/build/ sudo rm liveboot -Rf +# TODO: implement better garbage collection, allow to keep images +# +# cleanup $RSYNC_SRC, keep MAX number of images +# +MAX=15 +cd $RSYNC_SRC +COUNT=0 +for i in $(ls -atd1 ./liveboot-*) ; do + let COUNT=COUNT+1 + if [ $COUNT -gt $MAX ] ; then + echo rm -rfv $i + else + echo "keeping $i" + fi +done + # # Mirror # @@ -62,23 +78,7 @@ figlet "mirror to staging OK" echo "mirror to DCs is MISSING" -# TODO: garbage collection -# -# cleanup /srv/mirror, keep MAX number of images -# -#MAX=15 -#cd $RSYNC_SRC -#COUNT=0 -#for i in $(ls -atd1 ./${LIVE_TYPE}-*) ; do -# let COUNT=COUNT+1 -# if [ $COUNT -gt $MAX ] ; then -# rm -rfv $i -# else -# echo "keeping $i" -# fi -#done -echo -n "cleanup DISABLED: " du -sh /srv/mirror/liveboot figlet "OK"