myvesta/bin/v-unsuspend-web-domains
2013-06-01 14:25:44 +03:00

54 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# info: unsuspend web domains
# options: USER [RESTART]
#
# The function of unsuspending all user's sites.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
restart=$2
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [RESTART]'
validate_format 'user'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Starting unsuspend loop
for domain in $(search_objects 'web' 'SUSPENDED' "yes" 'DOMAIN'); do
$BIN/v-unsuspend-web-domain "$user" "$domain" 'no'
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
fi
# Logging
log_event "$OK" "$EVENT"
exit