v_list_sys_user_ips 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. # Defining fileds to select
  28. fields='$IP $OWNER $STATUS $NAME'
  29. # Listing domains
  30. case $format in
  31. json) ip_user_json_list ;;
  32. shell) ip_user_shell_list | column -t ;;
  33. *) check_args '1' '0' 'user [format] [limit] [offset]'
  34. esac
  35. #----------------------------------------------------------#
  36. # Vesta #
  37. #----------------------------------------------------------#
  38. # Logging
  39. log_event 'system' "$V_EVENT"
  40. exit $OK