From 8872f8ef4970942c4f8415a6cb76e0072c88f509 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 21 Jun 2012 15:01:36 +0200 Subject: [PATCH] implement very simple cleanup --- live_build.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 + -- 2.39.5