]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
implement very simple cleanup
authorHolger Levsen <holger@layer-acht.org>
Thu, 21 Jun 2012 13:01:36 +0000 (15:01 +0200)
committerHolger Levsen <holger@layer-acht.org>
Thu, 21 Jun 2012 13:01:36 +0000 (15:01 +0200)
live_build.sh

index 2e750ffe4fe0439e1ef05697bf717e96a6ee1535..0fdd29e91531f6c343af602ae75978da79685412 100755 (executable)
@@ -34,3 +34,16 @@ echo "Now rsyncing results to mgmt1..."
 rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete /srv/mirror/live-build/ rsync://livebuild@10.1.1.1/livebuild/*
 
 figlet "rsync success"
+
+#
+# cleanup /srv/mirror, keep max number of images
+# 
+cd /srv/mirror/live-build/
+COUNT=0
+for i in $(ls -artd1 ./${LIVE_TYPE}-*) ; do
+       let COUNT=COUNT+1
+       if [ $COUNT > 2 ] ; then
+               echo "would rm -rf $i" 
+       fi
+done
+