From: Holger Levsen Date: Thu, 21 Jun 2012 13:01:36 +0000 (+0200) Subject: implement very simple cleanup X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=8872f8ef4970942c4f8415a6cb76e0072c88f509;p=profitbricks%2Fjenkins-build-scripts.git implement very simple cleanup --- diff --git a/live_build.sh b/live_build.sh index 2e750ff..0fdd29e 100755 --- a/live_build.sh +++ b/live_build.sh @@ -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 +