]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
implement basic garbage collection, not yet activated
authorHolger Levsen <holger@layer-acht.org>
Fri, 14 Sep 2012 10:49:40 +0000 (12:49 +0200)
committerHolger Levsen <holger@layer-acht.org>
Fri, 14 Sep 2012 10:49:40 +0000 (12:49 +0200)
liveboot_build.sh

index 944d51350ba0a2b2a319f0f5ead4797d4ef40eeb..4bcdf56db9987fb737d8259c185dd0d102139fd6 100755 (executable)
@@ -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"