Files
VestaCP/bin/v_get_user_value
2012-04-30 12:32:11 +03:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# info: get user value
# options: user key
#
# The function for obtaining certain user's parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'user key'
validate_format 'user'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Checking key
value=$(get_user_value "$key")
# Printing value
echo "$value"
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$EVENT"
exit