Files
VestaCP/bin/v_delete_web_domains
2012-02-16 01:25:03 +02:00

74 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# info: delete web domains
# options: user
#
# The function deteles all user's webdomains.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
# Importing variables
source $VESTA/conf/vars.conf
source $V_CONF/vesta.conf
source $V_FUNC/shared.func
source $V_FUNC/domain.func
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
format_validation 'user'
# Checking web system is enabled
is_system_enabled 'web'
# Checking user
is_user_valid
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config
conf="$V_USERS/$user/web.conf"
# Defining fileds to select
field='$DOMAIN'
# Defining search string
search_string="SUSPENDED='no'"
# Parsing domain list
domains=$(dom_clear_search)
# Starting delete loop
for domain in $domains; do
$V_BIN/v_delete_web_domain "$user" "$domain"
rv="$?"
if [ "$rv" -ne '0' ]; then
log_event 'debug' "$rv $V_EVENT"
exit $rv
fi
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event 'system' "$V_EVENT"
exit