v_list_sys_user_ips 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. # info: listing user ips
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. format="${2-shell}"
  9. limit="${3-1000}"
  10. offset="${4-1}"
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_FUNC/shared_func.sh
  14. source $V_FUNC/ip_func.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking arg number
  19. check_args '1' "$#" 'user [format] [limit] [offset]'
  20. # Checking argument format
  21. format_validation 'user' 'limit' 'offset'
  22. # Checking user
  23. is_user_valid
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Get user owner
  28. owner=$(get_user_value '$OWNER')
  29. # Defining fileds to select
  30. fields='$IP $OWNER $STATUS $NAME'
  31. # Listing domains
  32. case $format in
  33. json) ip_user_json_list ;;
  34. shell) ip_user_shell_list | column -t ;;
  35. *) check_args '1' '0' 'user [format] [limit] [offset]'
  36. esac
  37. #----------------------------------------------------------#
  38. # Vesta #
  39. #----------------------------------------------------------#
  40. # Logging
  41. log_event 'system' "$V_EVENT"
  42. exit $OK