v_list_sys_user_backups 1.5 KB

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