vesta/bin/v-list-user-backups
2013-03-28 01:12:57 +02:00

57 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# info: list user backups
# options: USER [FORMAT]
#
# The function for obtainig the list of available user backups.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
format=${2-shell}
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [FORMAT]'
validate_format 'user'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Checking config
conf=$USER_DATA/backup.conf
if [ ! -e "$conf" ]; then
touch $conf
fi
# Defining fileds to select
fields="\$BACKUP \$TYPE \$SIZE \$WEB \$DNS \$DB \$MAIL \$CRON \$UDIR"
fields="$fields \$RUNTIME \$TIME \$DATE"
# Listing domains
case $format in
json) json_list ;;
plain) nohead=1; shell_list ;;
shell) fields='$BACKUP $TYPE $SIZE $RUNTIME $TIME $DATE';
shell_list |column -t;;
*) check_args '1' '0' '[FORMAT]' ;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit