v_list_sys_user_backups 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. conf=$V_USERS/$user/backup.conf
  25. if [ ! -e "$conf" ]; then
  26. touch $conf
  27. fi
  28. # Defining fileds to select
  29. fields="\$DATE \$TIME \$RUNTIME \$TYPE \$SIZE \$WEB \$DNS \$DB \$MAIL"
  30. fields="$fields \$CERTIFICATES \$CRON"
  31. # Listing domains
  32. case $format in
  33. json) json_list ;;
  34. plain) nohead=1; shell_list ;;
  35. shell) fields='$DATE $TIME $RUNTIME $TYPE $SIZE';shell_list |column -t ;;
  36. *) check_args '1' '0' '[format]' ;;
  37. esac
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. exit