v_list_sys_ip 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # info: listing system ip
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. ip="$1"
  8. format="${2-shell}"
  9. # Importing variables
  10. source $VESTA/conf/vars.conf
  11. source $V_FUNC/shared_func.sh
  12. source $V_FUNC/ip_func.sh
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking args
  17. check_args '1' "$#" 'ip [format]'
  18. # Checking argument format
  19. format_validation 'ip'
  20. # Checking ip
  21. is_sys_ip_valid
  22. #----------------------------------------------------------#
  23. # Action #
  24. #----------------------------------------------------------#
  25. # Defining fileds to select
  26. fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
  27. $INTERFACE $NETMASK $DATE'
  28. # Listing ip
  29. case $format in
  30. json) ip_json_single_list ;;
  31. shell) ip_shell_single_list | column -t ;;
  32. *) check_args '1' "0" 'ip [format]'
  33. esac
  34. #----------------------------------------------------------#
  35. # Vesta #
  36. #----------------------------------------------------------#
  37. # Logging
  38. log_event 'system' "$V_EVENT"
  39. exit $OK