Skip to content

Commit da5bcbe

Browse files
authored
Fix backup rotate for ftp/sftp mode
1 parent a217391 commit da5bcbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/v-backup-user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ ftp_backup() {
615615
fi
616616
backups_count=$(echo "$backup_list" |wc -l)
617617
if [ "$backups_count" -ge "$BACKUPS" ]; then
618-
backups_rm_number=$((backups_count - BACKUPS))
618+
backups_rm_number=$((backups_count - BACKUPS + 1))
619619
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
620620
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//")
621621
echo -e "$(date "+%F %T") Rotated ftp backup: $backup_date" |\
@@ -770,7 +770,7 @@ sftp_backup() {
770770
fi
771771
backups_count=$(echo "$backup_list" |wc -l)
772772
if [ "$backups_count" -ge "$BACKUPS" ]; then
773-
backups_rm_number=$((backups_count - BACKUPS))
773+
backups_rm_number=$((backups_count - BACKUPS + 1))
774774
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
775775
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar.*$//")
776776
echo -e "$(date "+%F %T") Rotated sftp backup: $backup_date" |\

0 commit comments

Comments
 (0)