mirror of
https://github.com/myvesta/vesta.git
synced 2025-01-12 05:52:53 -08:00
66 lines
1.8 KiB
Bash
Executable File
66 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: deleting web domain backend configuration
|
|
# options: USER DOMAIN [RESTART]
|
|
#
|
|
# The function of deleting the virtualhost backend configuration.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument defenition
|
|
user=$1
|
|
domain=$(idn -t --quiet -u "$2" )
|
|
domain_idn=$(idn -t --quiet -a "$domain")
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/func/domain.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'USER DOMAIN'
|
|
validate_format 'user' 'domain'
|
|
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
|
is_web_backend_pool_valid
|
|
|
|
# Checking last webdomain
|
|
domains=$(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'|wc -l)
|
|
if [ "$backend" = "$user" ] && [ "$domains" -gt 1 ]; then
|
|
exit
|
|
fi
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Deleting backend
|
|
rm -f $pool/$backend.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Restarting backend server
|
|
if [ "$restart" != 'no' ]; then
|
|
$BIN/v-restart-web-backend
|
|
check_result $? "Backend restart failed" >/dev/null
|
|
fi
|
|
|
|
# Logging
|
|
log_history "deleting backend support for $domain"
|
|
log_event "$OK" "$EVENT"
|
|
|
|
exit
|