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

66 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# info: deleting user ip
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user="$1"
ip="$2"
# Importing variables
source $VESTA/conf/vars.conf
source $V_FUNC/shared_func.sh
source $V_FUNC/ip_func.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user ip'
# Checking argument format
format_validation 'user' 'ip'
# Checking user
is_user_valid
# Checking user is active
is_user_suspended
# Checking user ip
is_sys_ip_valid
# Checking ownership
is_sys_ip_owner
# Checking webdomains on ip
is_ip_key_empty '$U_WEB_DOMAINS'
# Checking users on ip
is_ip_key_empty '$U_SYS_USERS'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Deleting owner
update_sys_ip_value '$OWNER' ''
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Updating user conf
decrease_user_value '$IP_OWNED'
# Logging
log_event 'system' "$V_EVENT"
exit $OK