mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
Refactoring stage IV (web)
This commit is contained in:
parent
0fb633a8c4
commit
3dcc180087
21 changed files with 102 additions and 329 deletions
|
@ -15,7 +15,7 @@ user=$1
|
||||||
domain=$2
|
domain=$2
|
||||||
format=${3-shell}
|
format=${3-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
# Json function
|
# Json function
|
||||||
|
@ -23,19 +23,10 @@ json_list_domain() {
|
||||||
i=1
|
i=1
|
||||||
fileds_count=$(echo "$fields" | wc -w)
|
fileds_count=$(echo "$fields" | wc -w)
|
||||||
line=$(grep "DOMAIN='$domain'" $conf)
|
line=$(grep "DOMAIN='$domain'" $conf)
|
||||||
|
|
||||||
# Print top bracket
|
|
||||||
echo '{'
|
echo '{'
|
||||||
|
|
||||||
# Assing key=value
|
|
||||||
eval $line
|
eval $line
|
||||||
|
|
||||||
# Starting output loop
|
|
||||||
for field in $fields; do
|
for field in $fields; do
|
||||||
# Parsing key=value
|
|
||||||
eval value=$field
|
eval value=$field
|
||||||
|
|
||||||
# Checking first field
|
|
||||||
if [ "$i" -eq 1 ]; then
|
if [ "$i" -eq 1 ]; then
|
||||||
echo -e "\t\"$value\": {"
|
echo -e "\t\"$value\": {"
|
||||||
else
|
else
|
||||||
|
@ -45,28 +36,23 @@ json_list_domain() {
|
||||||
echo -e "\t\t\"${field//$/}\": \"$value\""
|
echo -e "\t\t\"${field//$/}\": \"$value\""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Updating iterator
|
|
||||||
(( ++i))
|
(( ++i))
|
||||||
done
|
done
|
||||||
|
|
||||||
# If there was any output
|
|
||||||
if [ -n "$value" ]; then
|
if [ -n "$value" ]; then
|
||||||
echo -e ' }'
|
echo -e ' }'
|
||||||
fi
|
fi
|
||||||
# Printing bottom json bracket
|
|
||||||
echo -e "}"
|
echo -e "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Shell function
|
# Shell function
|
||||||
shell_list_domain() {
|
shell_list_domain() {
|
||||||
line=$(grep "DOMAIN='$domain'" $conf)
|
line=$(grep "DOMAIN='$domain'" $conf)
|
||||||
|
|
||||||
# Parsing key=value
|
|
||||||
eval $line
|
eval $line
|
||||||
|
|
||||||
# Print result line
|
|
||||||
for field in $fields; do
|
for field in $fields; do
|
||||||
eval key="$field"
|
eval key="$field"
|
||||||
|
if [ -z "$key" ]; then
|
||||||
|
key='NULL'
|
||||||
|
fi
|
||||||
echo "${field//$/}: $key "
|
echo "${field//$/}: $key "
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -76,14 +62,9 @@ shell_list_domain() {
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '2' "$#" 'user domain [format]'
|
check_args '2' "$#" 'user domain [format]'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
# Checking domain exist
|
|
||||||
is_domain_valid 'web'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -101,7 +82,7 @@ fields='$DOMAIN $IP $IP6 $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG
|
||||||
case $format in
|
case $format in
|
||||||
json) json_list_domain ;;
|
json) json_list_domain ;;
|
||||||
plain) nohead=1; shell_list_domain ;;
|
plain) nohead=1; shell_list_domain ;;
|
||||||
shell) shell_list_domain ;;
|
shell) shell_list_domain |column -t;;
|
||||||
*) check_args '2' '0' 'user domain [format]'
|
*) check_args '2' '0' 'user domain [format]'
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
||||||
domain=$2
|
domain=$2
|
||||||
format=${3-shell}
|
format=${3-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
# Json function
|
# Json function
|
||||||
|
@ -35,7 +35,6 @@ shell_list_ssl() {
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$key" ]; then
|
if [ ! -z "$key" ]; then
|
||||||
echo -e "\n$key"
|
echo -e "\n$key"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$ca" ]; then
|
if [ ! -z "$ca" ]; then
|
||||||
echo -e "\n$ca"
|
echo -e "\n$ca"
|
||||||
|
@ -47,15 +46,9 @@ shell_list_ssl() {
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '2' "$#" 'user domain [format]'
|
check_args '2' "$#" 'user domain [format]'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
# Checking domain exist
|
|
||||||
is_domain_valid 'web'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,13 +21,8 @@ source $VESTA/func/shared.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '1' "$#" 'user [format]'
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '1' "$#" 'user [format]'
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '1' "$#" 'user [format]'
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +36,7 @@ is_object_valid 'user' 'USER' "$user"
|
||||||
conf=$USER_DATA/web.conf
|
conf=$USER_DATA/web.conf
|
||||||
|
|
||||||
# Defining fileds to select
|
# Defining fileds to select
|
||||||
fields="\$DOMAIN \$ELOG"
|
fields="\$DOMAIN \$ELOG \$SUSPENDED \$TIME \$DATE"
|
||||||
|
|
||||||
# Listing domains
|
# Listing domains
|
||||||
case $format in
|
case $format in
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '1' "$#" 'user [format]'
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '1' "$#" 'user [format]'
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +36,7 @@ is_object_valid 'user' 'USER' "$user"
|
||||||
conf="$USER_DATA/web.conf"
|
conf="$USER_DATA/web.conf"
|
||||||
|
|
||||||
# Defining fileds to select
|
# Defining fileds to select
|
||||||
fields="\$DOMAIN \$IP \$TPL \$SSL \$SSL_HOME"
|
fields="\$DOMAIN \$IP \$TPL \$SSL \$SSL_HOME \$SUSPENDED"
|
||||||
|
|
||||||
# Listing domains
|
# Listing domains
|
||||||
case $format in
|
case $format in
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,13 +24,8 @@ source $VESTA/func/shared.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
|
||||||
check_args '1' "$#" 'user [format]'
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +37,7 @@ is_object_valid 'user' 'USER' "$user"
|
||||||
conf=$USER_DATA/web.conf
|
conf=$USER_DATA/web.conf
|
||||||
|
|
||||||
# Defining fileds to select
|
# Defining fileds to select
|
||||||
fields="\$DOMAIN \$STATS \$STATS_AUTH"
|
fields="\$DOMAIN \$STATS \$STATS_AUTH \$SUSPENDED \$TIME \$DATE"
|
||||||
|
|
||||||
# Listing domains
|
# Listing domains
|
||||||
case $format in
|
case $format in
|
||||||
|
|
|
@ -13,31 +13,25 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
# Json function
|
# Json function
|
||||||
json_list_wtpl() {
|
json_list_wtpl() {
|
||||||
i='1' # iterator
|
i=1
|
||||||
echo '{'
|
echo '{'
|
||||||
|
|
||||||
# Listing files by mask
|
|
||||||
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
|
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
|
||||||
if [ -e "$WEBTPL/apache_$template.descr" ]; then
|
if [ -e "$WEBTPL/apache_$template.descr" ]; then
|
||||||
descr=$(cat $WEBTPL/apache_$template.descr | grep '#'|\
|
descr=$(cat $WEBTPL/apache_$template.descr | grep '#'|\
|
||||||
sed -e ':a;N;$!ba;s/\n/ /g')
|
sed -e ':a;N;$!ba;s/\n/ /g')
|
||||||
# Checking !first line to print bracket
|
|
||||||
if [ $i -ne 1 ]; then
|
if [ $i -ne 1 ]; then
|
||||||
echo -e "\t},"
|
echo -e "\t},"
|
||||||
fi
|
fi
|
||||||
# Print result
|
|
||||||
echo -e "\t\"$template\": {"
|
echo -e "\t\"$template\": {"
|
||||||
echo -e "\t\t\"DESCR\": \"${descr//# /}\""
|
echo -e "\t\t\"DESCR\": \"${descr//# /}\""
|
||||||
(( ++i))
|
(( ++i))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If there was any output
|
|
||||||
if [ -n "$template" ]; then
|
if [ -n "$template" ]; then
|
||||||
echo -e "\t}"
|
echo -e "\t}"
|
||||||
fi
|
fi
|
||||||
|
@ -63,13 +57,8 @@ shell_list_wtpl() {
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user'
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,31 +13,26 @@
|
||||||
user=$1
|
user=$1
|
||||||
format=${2-shell}
|
format=${2-shell}
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
|
|
||||||
# Json function
|
# Json function
|
||||||
json_list_wtpl() {
|
json_list_wtpl() {
|
||||||
i='1' # iterator
|
i='1' # iterator
|
||||||
echo '{'
|
echo '{'
|
||||||
|
|
||||||
# Listing files by mask
|
|
||||||
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
|
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
|
||||||
if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then
|
if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then
|
||||||
descr=$(cat $WEBTPL/ngingx_vhost_$template.descr | grep '#'|\
|
descr=$(cat $WEBTPL/ngingx_vhost_$template.descr | grep '#'|\
|
||||||
sed -e ':a;N;$!ba;s/\n/ /g')
|
sed -e ':a;N;$!ba;s/\n/ /g')
|
||||||
# Checking !first line to print bracket
|
|
||||||
if [ $i -ne 1 ]; then
|
if [ $i -ne 1 ]; then
|
||||||
echo -e "\t},"
|
echo -e "\t},"
|
||||||
fi
|
fi
|
||||||
# Print result
|
|
||||||
echo -e "\t\"$template\": {"
|
echo -e "\t\"$template\": {"
|
||||||
echo -e "\t\t\"DESCR\": \"${descr//# /}\""
|
echo -e "\t\t\"DESCR\": \"${descr//# /}\""
|
||||||
(( ++i))
|
(( ++i))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If there was any output
|
|
||||||
if [ -n "$template" ]; then
|
if [ -n "$template" ]; then
|
||||||
echo -e "\t}"
|
echo -e "\t}"
|
||||||
fi
|
fi
|
||||||
|
@ -63,13 +58,8 @@ shell_list_wtpl() {
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user'
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,10 @@ url=${2-$SUSPEND_URL}
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user [suspend_url]'
|
check_args '1' "$#" 'user [suspend_url]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'url'
|
validate_format 'user' 'url'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
# Checking user is active
|
|
||||||
is_object_unsuspended 'user' 'USER' "$user"
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +218,7 @@ update_user_value "$user" '$U_WEB_DOMAINS' "$user_domains"
|
||||||
update_user_value "$user" '$U_WEB_SSL' "$user_ssl"
|
update_user_value "$user" '$U_WEB_SSL' "$user_ssl"
|
||||||
update_user_value "$user" '$U_WEB_ALIASES' "$user_aliases"
|
update_user_value "$user" '$U_WEB_ALIASES' "$user_aliases"
|
||||||
|
|
||||||
# Adding task to the vesta pipe
|
# Restart web server
|
||||||
$BIN/v_restart_web "$EVENT"
|
$BIN/v_restart_web "$EVENT"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
|
|
|
@ -16,36 +16,25 @@ user=$1
|
||||||
domain=$(idn -t --quiet -u "$2" )
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
domain_idn=$(idn -t --quiet -a "$domain")
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
|
||||||
# Defining url
|
|
||||||
url="${3-$SUSPEND_URL}"
|
url="${3-$SUSPEND_URL}"
|
||||||
|
restart=$4
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '2' "$#" 'user domain [suspend_url]'
|
check_args '2' "$#" 'user domain [suspend_url]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'domain' 'url'
|
validate_format 'user' 'domain' 'url'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
# Checking domain exist
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||||
is_domain_valid 'web'
|
|
||||||
|
|
||||||
# Checking domain is not suspened
|
|
||||||
is_domain_suspended 'web'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -94,12 +83,14 @@ fi
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Adding suspend in config
|
# Update config
|
||||||
update_domain_value 'web' '$SUSPENDED' 'yes'
|
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
|
||||||
increase_user_value "$user" '$SUSPENDED_WEB'
|
increase_user_value "$user" '$SUSPENDED_WEB'
|
||||||
|
|
||||||
# Adding task to the vesta pipe
|
# Restart web server
|
||||||
$BIN/v_restart_web "$EVENT"
|
if [ "$restart" != 'no' ]; then
|
||||||
|
$BIN/v_restart_web "$EVENT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_event "$OK" "$EVENT"
|
log_event "$OK" "$EVENT"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -25,16 +25,9 @@ url="${2-$SUSPEND_URL}"
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user [suspend_url]'
|
check_args '1' "$#" 'user [suspend_url]'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'url'
|
validate_format 'user' 'url'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,17 +35,9 @@ is_object_valid 'user' 'USER' "$user"
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining config
|
|
||||||
conf="$USER_DATA/web.conf"
|
|
||||||
|
|
||||||
# Defining fileds to select
|
|
||||||
field='$DOMAIN'
|
|
||||||
search_string="SUSPENDED='no'"
|
|
||||||
domains=$(dom_clear_search)
|
|
||||||
|
|
||||||
# Starting suspend loop
|
# Starting suspend loop
|
||||||
for domain in $domains; do
|
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
|
||||||
$BIN/v_suspend_web_domain "$user" "$domain" "$url"
|
$BIN/v_suspend_web_domain "$user" "$domain" "$url" 'no'
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +45,9 @@ done
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Restart web server
|
||||||
|
$BIN/v_restart_web "$EVENT"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_event "$OK" "$EVENT"
|
log_event "$OK" "$EVENT"
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,9 @@
|
||||||
user=$1
|
user=$1
|
||||||
domain=$(idn -t --quiet -u "$2" )
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
domain_idn=$(idn -t --quiet -a "$domain")
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
restart="$3"
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -24,23 +25,12 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '2' "$#" 'user domain'
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'domain'
|
validate_format 'user' 'domain'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
# Checking domain exist
|
is_object_suspended 'web' 'DOMAIN' "$domain"
|
||||||
is_domain_valid 'web'
|
|
||||||
|
|
||||||
# Check domain is suspened
|
|
||||||
is_domain_unsuspended 'web'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -89,12 +79,14 @@ fi
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Updating suspend keys
|
# Update config
|
||||||
update_domain_value 'web' '$SUSPENDED' 'no'
|
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
|
||||||
decrease_user_value "$user" '$SUSPENDED_WEB'
|
decrease_user_value "$user" '$SUSPENDED_WEB'
|
||||||
|
|
||||||
# Adding task to the vesta pipe
|
# Restart web erver
|
||||||
$BIN/v_restart_web "$EVENT"
|
if [ "$restart" != 'no' ]; then
|
||||||
|
$BIN/v_restart_web "$EVENT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_event "$OK" "$EVENT"
|
log_event "$OK" "$EVENT"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -22,16 +22,9 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user'
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,15 +32,9 @@ is_object_valid 'user' 'USER' "$user"
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining fileds to select
|
|
||||||
conf="$USER_DATA/web.conf"
|
|
||||||
field='$DOMAIN'
|
|
||||||
search_string="SUSPENDED='yes'"
|
|
||||||
domains=$(dom_clear_search)
|
|
||||||
|
|
||||||
# Starting unsuspend loop
|
# Starting unsuspend loop
|
||||||
for domain in $domains; do
|
for domain in $(search_objects 'web' 'SUSPENDED' "yes" 'DOMAIN'); do
|
||||||
$BIN/v_unsuspend_web_domain "$user" "$domain"
|
$BIN/v_unsuspend_web_domain "$user" "$domain" 'no'
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +42,9 @@ done
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Restart web server
|
||||||
|
$BIN/v_restart_web "$EVENT"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_event "$OK" "$EVENT"
|
log_event "$OK" "$EVENT"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
||||||
domain=$(idn -t --quiet -u "$2" )
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
domain_idn=$(idn -t --quiet -a "$domain")
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -24,23 +24,13 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '2' "$#" 'user domain'
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'domain'
|
validate_format 'user' 'domain'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
# Checking domain exist
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
is_domain_valid 'web'
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||||
|
|
||||||
# Checking domain is not suspened
|
|
||||||
is_domain_suspended 'web'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -61,9 +51,7 @@ fi
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Updating disk value in config
|
# Updating disk value in config
|
||||||
update_domain_value 'web' '$U_DISK' "$disk_usage"
|
update_object_value 'web' 'DOMAIN' "$domain" '$U_DISK' "$disk_usage"
|
||||||
|
|
||||||
# Recalculating user disk space
|
|
||||||
recalc_user_disk_usage
|
recalc_user_disk_usage
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
||||||
domain=$(idn -t --quiet -u "$2" )
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
domain_idn=$(idn -t --quiet -a "$domain")
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -24,39 +24,27 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '2' "$#" 'user domain'
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'domain'
|
validate_format 'user' 'domain'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
# Checking domain exist
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
is_domain_valid 'web'
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||||
|
is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS'
|
||||||
# Checking domain is not suspened
|
|
||||||
is_domain_suspended 'web'
|
|
||||||
|
|
||||||
# Checking stats enabled
|
|
||||||
is_domain_value_exist 'web' '$STATS'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
stats=$(get_domain_value 'web' '$STATS')
|
get_domain_values 'web'
|
||||||
|
|
||||||
# Checking config
|
# Checking config
|
||||||
config="$HOMEDIR/$user/conf/web/$stats.$domain.conf"
|
config="$HOMEDIR/$user/conf/web/$STATS.$domain.conf"
|
||||||
if [ ! -e "$config" ]; then
|
if [ ! -e "$config" ]; then
|
||||||
echo "Error: Parsing error"
|
echo "Error: Parsing error"
|
||||||
log_event 'debug' "$E_PARSING $EVENT"
|
log_event "$E_PARSING" "$EVENT"
|
||||||
exit $E_PARSING
|
exit $E_PARSING
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
||||||
domain=$(idn -t --quiet -u "$2" )
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
domain_idn=$(idn -t --quiet -a "$domain")
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -24,23 +24,13 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '2' "$#" 'user domain'
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user' 'domain'
|
validate_format 'user' 'domain'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
# Checking domain exist
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||||
is_domain_valid 'web'
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||||
|
|
||||||
# Checking domain is not suspened
|
|
||||||
is_domain_suspended 'web'
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -54,10 +44,8 @@ log_file="/var/log/httpd/domains/$domain.bytes"
|
||||||
bytes=0
|
bytes=0
|
||||||
|
|
||||||
# Parsing log
|
# Parsing log
|
||||||
while read line
|
while read line; do
|
||||||
do
|
if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]; then
|
||||||
if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]
|
|
||||||
then
|
|
||||||
bytes=$(($bytes + $line))
|
bytes=$(($bytes + $line))
|
||||||
fi
|
fi
|
||||||
done < $log_file
|
done < $log_file
|
||||||
|
@ -74,13 +62,13 @@ echo > $log_file
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Parsing old value
|
# Parsing old value
|
||||||
old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
|
get_domain_values 'web'
|
||||||
|
|
||||||
# Defining new value
|
# Defining new value
|
||||||
bandwidth=$((old_val + mb))
|
bandwidth=$((U_BANDWIDTH + mb))
|
||||||
|
|
||||||
# Updating bandwidth value in config
|
# Updating bandwidth value in config
|
||||||
update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
|
update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' "$bandwidth"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_event "$OK" "$EVENT"
|
log_event "$OK" "$EVENT"
|
||||||
|
|
|
@ -12,54 +12,33 @@
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user'
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining config
|
# Domain loop
|
||||||
conf="$USER_DATA/web.conf"
|
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
|
||||||
|
|
||||||
# Defining fileds to select
|
|
||||||
field='$DOMAIN'
|
|
||||||
search_string="SUSPENDED='no'"
|
|
||||||
domains=$(dom_clear_search)
|
|
||||||
|
|
||||||
# Starting update disk loop
|
|
||||||
for domain in $domains; do
|
|
||||||
|
|
||||||
# Defining home directory
|
|
||||||
home_dir="$HOMEDIR/$user/web/$domain/"
|
home_dir="$HOMEDIR/$user/web/$domain/"
|
||||||
|
|
||||||
# Checking home directory exist
|
|
||||||
if [ -e "$home_dir" ]; then
|
if [ -e "$home_dir" ]; then
|
||||||
disk_usage=$(nice -n 19 du -shm $home_dir | cut -f 1 )
|
disk_usage=$(nice -n 19 du -shm $home_dir | cut -f 1 )
|
||||||
fi
|
fi
|
||||||
|
update_object_value 'web' 'DOMAIN' "$domain" '$U_DISK' "$disk_usage"
|
||||||
# Updating disk value in config
|
|
||||||
update_domain_value 'web' '$U_DISK' "$disk_usage"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -22,41 +22,22 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user'
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining fileds to select
|
|
||||||
field='$DOMAIN'
|
|
||||||
conf="$USER_DATA/web.conf"
|
|
||||||
search_string="SUSPENDED='no'"
|
|
||||||
|
|
||||||
# Parsing domain list
|
|
||||||
domains=$(dom_clear_search)
|
|
||||||
|
|
||||||
# Starting upd loop
|
# Starting upd loop
|
||||||
for domain in $domains; do
|
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
|
||||||
stats=$(get_domain_value 'web' '$STATS')
|
get_domain_values 'web'
|
||||||
if [ ! -z "$stats" ]; then
|
if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
|
||||||
$BIN/v_update_web_domain_stat "$user" "$domain"
|
$BIN/v_update_web_domain_stat "$user" "$domain"
|
||||||
rv="$?"
|
|
||||||
if [ "$rv" -ne '0' ]; then
|
|
||||||
log_event 'debug' "$rv $EVENT"
|
|
||||||
exit $rv
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/domain.sh
|
source $VESTA/func/domain.sh
|
||||||
|
@ -22,42 +22,19 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking arg number
|
|
||||||
check_args '1' "$#" 'user'
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
# Checking argument format
|
|
||||||
validate_format 'user'
|
validate_format 'user'
|
||||||
|
is_system_enabled "$WEB_SYSTEM"
|
||||||
# Checking web system is enabled
|
|
||||||
is_system_enabled 'WEB_SYSTEM'
|
|
||||||
|
|
||||||
# Checking user
|
|
||||||
is_object_valid 'user' 'USER' "$user" "$user"
|
is_object_valid 'user' 'USER' "$user" "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining config
|
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
|
||||||
conf="$USER_DATA/web.conf"
|
|
||||||
|
|
||||||
# Defining fileds to select
|
|
||||||
field='$DOMAIN'
|
|
||||||
|
|
||||||
# Defining search string
|
|
||||||
search_string="SUSPENDED='no'"
|
|
||||||
|
|
||||||
# Parsing unsuspeneded domains
|
|
||||||
domains=$(dom_clear_search)
|
|
||||||
|
|
||||||
# Starting suspend loop
|
|
||||||
for domain in $domains; do
|
|
||||||
|
|
||||||
# Defining log file
|
|
||||||
log_file="/var/log/httpd/domains/$domain.bytes"
|
log_file="/var/log/httpd/domains/$domain.bytes"
|
||||||
|
|
||||||
# Defining bytes
|
|
||||||
bytes=0
|
bytes=0
|
||||||
|
|
||||||
# Parsing log
|
# Parsing log
|
||||||
|
@ -73,14 +50,11 @@ for domain in $domains; do
|
||||||
# Nulling log
|
# Nulling log
|
||||||
echo > $log_file
|
echo > $log_file
|
||||||
|
|
||||||
# Parsing old value
|
get_domain_values 'web'
|
||||||
old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
|
bandwidth=$((U_BANDWIDTH + mb))
|
||||||
|
|
||||||
# Defining new value
|
|
||||||
bandwidth=$((old_val + mb))
|
|
||||||
|
|
||||||
# Updating bandwidth value in config
|
# Updating bandwidth value in config
|
||||||
update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
|
update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' "$bandwidth"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue