mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
Update v-backup-user
I noticed that I always seemed to have 1 less backup than I was supposed to in my VestaCP. This fix resolves the issue for me. Problem outlined: - My VestaCP package says that I'm supposed to be allowed 3 backups. - The backups tab of the GUI showed that I had 3 backups. - I was never able to access the oldest backup (Almost like it wasn't actually there). - I checked the backup folder using SSH and I found that I only ever have the latest 2 backups available. - It was clear that a script was deleting the 3rd backup prematurely.
This commit is contained in:
parent
4e769aa83d
commit
e71a1619f0
1 changed files with 3 additions and 4 deletions
|
@ -483,7 +483,6 @@ local_backup(){
|
||||||
backups_count=$(echo "$backup_list" |wc -l)
|
backups_count=$(echo "$backup_list" |wc -l)
|
||||||
if [ "$BACKUPS" -le "$backups_count" ]; then
|
if [ "$BACKUPS" -le "$backups_count" ]; then
|
||||||
backups_rm_number=$((backups_count - BACKUPS))
|
backups_rm_number=$((backups_count - BACKUPS))
|
||||||
(( ++backups_rm_number))
|
|
||||||
|
|
||||||
# Removing old backup
|
# Removing old backup
|
||||||
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
||||||
|
@ -599,7 +598,7 @@ ftp_backup() {
|
||||||
fi
|
fi
|
||||||
backups_count=$(echo "$backup_list" |wc -l)
|
backups_count=$(echo "$backup_list" |wc -l)
|
||||||
if [ "$backups_count" -ge "$BACKUPS" ]; then
|
if [ "$backups_count" -ge "$BACKUPS" ]; then
|
||||||
backups_rm_number=$((backups_count - BACKUPS + 1))
|
backups_rm_number=$((backups_count - BACKUPS))
|
||||||
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
||||||
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//")
|
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//")
|
||||||
echo -e "$(date "+%F %T") Rotated ftp backup: $backup_date" |\
|
echo -e "$(date "+%F %T") Rotated ftp backup: $backup_date" |\
|
||||||
|
@ -754,7 +753,7 @@ sftp_backup() {
|
||||||
fi
|
fi
|
||||||
backups_count=$(echo "$backup_list" |wc -l)
|
backups_count=$(echo "$backup_list" |wc -l)
|
||||||
if [ "$backups_count" -ge "$BACKUPS" ]; then
|
if [ "$backups_count" -ge "$BACKUPS" ]; then
|
||||||
backups_rm_number=$((backups_count - BACKUPS + 1))
|
backups_rm_number=$((backups_count - BACKUPS))
|
||||||
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
||||||
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar.*$//")
|
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar.*$//")
|
||||||
echo -e "$(date "+%F %T") Rotated sftp backup: $backup_date" |\
|
echo -e "$(date "+%F %T") Rotated sftp backup: $backup_date" |\
|
||||||
|
@ -803,7 +802,7 @@ google_backup() {
|
||||||
backup_list=$(${gsutil} ls gs://$BUCKET/$BPATH/$user.* 2>/dev/null)
|
backup_list=$(${gsutil} ls gs://$BUCKET/$BPATH/$user.* 2>/dev/null)
|
||||||
backups_count=$(echo "$backup_list" |wc -l)
|
backups_count=$(echo "$backup_list" |wc -l)
|
||||||
if [ "$backups_count" -ge "$BACKUPS" ]; then
|
if [ "$backups_count" -ge "$BACKUPS" ]; then
|
||||||
backups_rm_number=$((backups_count - BACKUPS + 1))
|
backups_rm_number=$((backups_count - BACKUPS))
|
||||||
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
|
||||||
echo -e "$(date "+%F %T") Roated gcp backup: $backup"
|
echo -e "$(date "+%F %T") Roated gcp backup: $backup"
|
||||||
$gsutil rm $backup > /dev/null 2>&1
|
$gsutil rm $backup > /dev/null 2>&1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue