Skip to content

Commit

Permalink
Fix loop counter in database backup removal
Browse files Browse the repository at this point in the history
  • Loading branch information
mbomhoff committed Mar 28, 2017
1 parent f70430a commit 9e5c741
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripts/backup/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,25 @@ $ICMD/iput -bfr $LOCAL_MYSQL $REMOTE
#
echo `date` "Deleting old LOCAL database backups"
#LOCAL_DELETIONS=`find $LOCAL/mysql_* -maxdepth 1 -type d -mtime +$DAYS_UNTIL_DELETE`
count=1
for d in `ls -td /storage/coge/backup/*/ | grep 'mysql_'`
for d in `ls -td $LOCAL/*/ | grep 'mysql_'`
do
if [ $count -gt $MAX_LOCAL_BACKUPS ];
if [ $MAX_LOCAL_BACKUPS -le 0 ];
then
echo deleting local $d
rm -rf $d
fi
((count++))
((MAX_LOCAL_BACKUPS--))
done

echo `date` "Deleting old REMOTE database backups (local & remote)"
count=1
for d in `$ICMD/ils backup | grep 'mysql_' | sed 's/.*\(mysql_.*\)/\1/'`
for d in `$ICMD/ils $REMOTE | grep 'mysql_' | sed 's/.*\(mysql_.*\)/\1/'`
do
if [ $count -gt $MAX_REMOTE_BACKUPS ];
if [ $MAX_REMOTE_BACKUPS -le 0 ];
then
echo deleting IRODS backup/$d
$ICMD/irm -r backup/$d
fi
((count++))
((MAX_REMOTE_BACKUPS--))
done

#
Expand Down

0 comments on commit 9e5c741

Please sign in to comment.