backup pages

This commit is contained in:
Serghey Rodin 2012-06-28 14:11:35 +03:00
commit 7a99bd4ad0
7 changed files with 153 additions and 4 deletions

View file

@ -390,6 +390,9 @@ local_backup(){
chown nginx:$user $BACKUP/$user.$DATE.tar
localbackup='yes'
echo
U_BACKUPS=$(ls $BACKUP/|grep "^$user."|wc -l)
update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS"
}

53
bin/v_delete_user_backup Executable file
View file

@ -0,0 +1,53 @@
#!/bin/bash
# info: delete user backup
# options: user nackup
#
# The function deletes user backup.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
backup=$(echo $2| cut -f 2 -d \.)
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'user backup'
validate_format 'user' 'backup'
is_system_enabled "$BACKUP_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'backup' 'BACKUP' "$2"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Deleting backup
rm -f $BACKUP/$2
sed -i "/BACKUP='$2' /d" $USER_DATA/backup.conf
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Update counter
U_BACKUPS=$(ls $BACKUP/|grep "^$user."|wc -l)
update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS"
# Logging
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit