v_list_user_backups 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # info: list user backups
  3. # options: user [format]
  4. #
  5. # The function for obtainig the list of available user backups.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. format=${2-shell}
  12. # Importing variables
  13. source $VESTA/conf/vars.conf
  14. source $V_FUNC/shared.func
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking args
  19. check_args '1' "$#" 'user [format]'
  20. # Checking argument format
  21. format_validation 'user'
  22. # Checking user
  23. is_user_valid
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Checking config
  28. conf=$V_USERS/$user/backup.conf
  29. if [ ! -e "$conf" ]; then
  30. touch $conf
  31. fi
  32. # Defining fileds to select
  33. fields="\$DATE \$TIME \$RUNTIME \$TYPE \$SIZE \$VESTA \$PAM \$WEB \$DNS \$DB"
  34. fields="$fields \$MAIL \$CRON"
  35. # Listing domains
  36. case $format in
  37. json) json_list ;;
  38. plain) nohead=1; shell_list ;;
  39. shell) fields='$DATE $TIME $RUNTIME $TYPE $SIZE'; shell_list |column -t;;
  40. *) check_args '1' '0' '[format]' ;;
  41. esac
  42. #----------------------------------------------------------#
  43. # Vesta #
  44. #----------------------------------------------------------#
  45. exit