vesta/bin/v_list_sys_ip
2011-06-14 00:22:25 +03:00

55 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# info: listing system ip
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
ip="$1"
format="${2-shell}"
# Importing variables
source $VESTA/conf/vars.conf
source $V_FUNC/shared_func.sh
source $V_FUNC/ip_func.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'ip [format]'
# Checking argument format
format_validation 'ip'
# Checking ip
is_sys_ip_valid
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining fileds to select
fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
$INTERFACE $NETMASK $DATE'
# Listing ip
case $format in
json) ip_json_single_list ;;
shell) ip_shell_single_list | column -t ;;
*) check_args '1' "0" 'ip [format]'
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event 'system' "$V_EVENT"
exit $OK