Refactoring stage IV (web)

This commit is contained in:
Serghey Rodin 2012-03-29 17:03:50 +03:00
commit 3dcc180087
21 changed files with 102 additions and 329 deletions

View file

@ -15,7 +15,7 @@ user=$1
domain=$2
format=${3-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
# Json function
@ -23,19 +23,10 @@ json_list_domain() {
i=1
fileds_count=$(echo "$fields" | wc -w)
line=$(grep "DOMAIN='$domain'" $conf)
# Print top bracket
echo '{'
# Assing key=value
eval $line
# Starting output loop
for field in $fields; do
# Parsing key=value
eval value=$field
# Checking first field
if [ "$i" -eq 1 ]; then
echo -e "\t\"$value\": {"
else
@ -45,28 +36,23 @@ json_list_domain() {
echo -e "\t\t\"${field//$/}\": \"$value\""
fi
fi
# Updating iterator
(( ++i))
done
# If there was any output
if [ -n "$value" ]; then
echo -e ' }'
fi
# Printing bottom json bracket
echo -e "}"
}
# Shell function
shell_list_domain() {
line=$(grep "DOMAIN='$domain'" $conf)
# Parsing key=value
eval $line
# Print result line
for field in $fields; do
eval key="$field"
if [ -z "$key" ]; then
key='NULL'
fi
echo "${field//$/}: $key "
done
}
@ -76,14 +62,9 @@ shell_list_domain() {
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '2' "$#" 'user domain [format]'
# Checking user
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
is_object_valid 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
@ -101,7 +82,7 @@ fields='$DOMAIN $IP $IP6 $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG
case $format in
json) json_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]'
esac

View file

@ -14,7 +14,7 @@ user=$1
domain=$2
format=${3-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
# Json function
@ -35,7 +35,6 @@ shell_list_ssl() {
fi
if [ ! -z "$key" ]; then
echo -e "\n$key"
fi
if [ ! -z "$ca" ]; then
echo -e "\n$ca"
@ -47,15 +46,9 @@ shell_list_ssl() {
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '2' "$#" 'user domain [format]'
# Checking user
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
is_object_valid 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
# Action #

View file

@ -13,7 +13,7 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
@ -21,13 +21,8 @@ source $VESTA/func/shared.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'user [format]'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"

View file

@ -15,7 +15,7 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'user [format]'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"

View file

@ -15,7 +15,7 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'user [format]'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"
@ -41,7 +36,7 @@ is_object_valid 'user' 'USER' "$user"
conf=$USER_DATA/web.conf
# Defining fileds to select
fields="\$DOMAIN \$ELOG"
fields="\$DOMAIN \$ELOG \$SUSPENDED \$TIME \$DATE"
# Listing domains
case $format in

View file

@ -15,7 +15,7 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'user [format]'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"

View file

@ -15,7 +15,7 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
@ -23,13 +23,8 @@ source $VESTA/func/shared.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'user [format]'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"
@ -41,7 +36,7 @@ is_object_valid 'user' 'USER' "$user"
conf="$USER_DATA/web.conf"
# Defining fileds to select
fields="\$DOMAIN \$IP \$TPL \$SSL \$SSL_HOME"
fields="\$DOMAIN \$IP \$TPL \$SSL \$SSL_HOME \$SUSPENDED"
# Listing domains
case $format in

View file

@ -16,7 +16,7 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
@ -24,13 +24,8 @@ source $VESTA/func/shared.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'user [format]'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"
@ -42,7 +37,7 @@ is_object_valid 'user' 'USER' "$user"
conf=$USER_DATA/web.conf
# Defining fileds to select
fields="\$DOMAIN \$STATS \$STATS_AUTH"
fields="\$DOMAIN \$STATS \$STATS_AUTH \$SUSPENDED \$TIME \$DATE"
# Listing domains
case $format in

View file

@ -13,31 +13,25 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
# Json function
json_list_wtpl() {
i='1' # iterator
i=1
echo '{'
# Listing files by mask
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
if [ -e "$WEBTPL/apache_$template.descr" ]; then
descr=$(cat $WEBTPL/apache_$template.descr | grep '#'|\
sed -e ':a;N;$!ba;s/\n/ /g')
# Checking !first line to print bracket
if [ $i -ne 1 ]; then
echo -e "\t},"
fi
# Print result
echo -e "\t\"$template\": {"
echo -e "\t\t\"DESCR\": \"${descr//# /}\""
(( ++i))
fi
done
# If there was any output
if [ -n "$template" ]; then
echo -e "\t}"
fi
@ -63,13 +57,8 @@ shell_list_wtpl() {
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"

View file

@ -13,31 +13,26 @@
user=$1
format=${2-shell}
# Importing variables
# Includes
source $VESTA/func/shared.sh
# Json function
json_list_wtpl() {
i='1' # iterator
echo '{'
# Listing files by mask
for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
if [ -e "$WEBTPL/ngingx_vhost_$template.descr" ]; then
descr=$(cat $WEBTPL/ngingx_vhost_$template.descr | grep '#'|\
sed -e ':a;N;$!ba;s/\n/ /g')
# Checking !first line to print bracket
if [ $i -ne 1 ]; then
echo -e "\t},"
fi
# Print result
echo -e "\t\"$template\": {"
echo -e "\t\t\"DESCR\": \"${descr//# /}\""
(( ++i))
fi
done
# If there was any output
if [ -n "$template" ]; then
echo -e "\t}"
fi
@ -63,13 +58,8 @@ shell_list_wtpl() {
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking user
is_object_valid 'user' 'USER' "$user"

View file

@ -24,19 +24,10 @@ url=${2-$SUSPEND_URL}
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user [suspend_url]'
# Checking argument format
validate_format 'user' 'url'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
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_ALIASES' "$user_aliases"
# Adding task to the vesta pipe
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging

View file

@ -16,36 +16,25 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
# Defining url
url="${3-$SUSPEND_URL}"
restart=$4
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain [suspend_url]'
# Checking argument format
validate_format 'user' 'domain' 'url'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
@ -94,12 +83,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding suspend in config
update_domain_value 'web' '$SUSPENDED' 'yes'
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
increase_user_value "$user" '$SUSPENDED_WEB'
# Adding task to the vesta pipe
$BIN/v_restart_web "$EVENT"
# Restart web server
if [ "$restart" != 'no' ]; then
$BIN/v_restart_web "$EVENT"
fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -12,7 +12,7 @@
# Argument defenition
user=$1
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -25,16 +25,9 @@ url="${2-$SUSPEND_URL}"
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user [suspend_url]'
# Checking argument format
validate_format 'user' 'url'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@ -42,17 +35,9 @@ is_object_valid 'user' 'USER' "$user"
# 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
for domain in $domains; do
$BIN/v_suspend_web_domain "$user" "$domain" "$url"
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
$BIN/v_suspend_web_domain "$user" "$domain" "$url" 'no'
done
@ -60,6 +45,9 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -13,8 +13,9 @@
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
restart="$3"
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,23 +25,12 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Check domain is suspened
is_domain_unsuspended 'web'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_suspended 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
@ -89,12 +79,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Updating suspend keys
update_domain_value 'web' '$SUSPENDED' 'no'
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_WEB'
# Adding task to the vesta pipe
$BIN/v_restart_web "$EVENT"
# Restart web erver
if [ "$restart" != 'no' ]; then
$BIN/v_restart_web "$EVENT"
fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -12,7 +12,7 @@
# Argument defenition
user=$1
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -22,16 +22,9 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@ -39,15 +32,9 @@ is_object_valid 'user' 'USER' "$user"
# Action #
#----------------------------------------------------------#
# Defining fileds to select
conf="$USER_DATA/web.conf"
field='$DOMAIN'
search_string="SUSPENDED='yes'"
domains=$(dom_clear_search)
# Starting unsuspend loop
for domain in $domains; do
$BIN/v_unsuspend_web_domain "$user" "$domain"
for domain in $(search_objects 'web' 'SUSPENDED' "yes" 'DOMAIN'); do
$BIN/v_unsuspend_web_domain "$user" "$domain" 'no'
done
@ -55,6 +42,9 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -14,7 +14,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,23 +24,13 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
@ -61,9 +51,7 @@ fi
#----------------------------------------------------------#
# Updating disk value in config
update_domain_value 'web' '$U_DISK' "$disk_usage"
# Recalculating user disk space
update_object_value 'web' 'DOMAIN' "$domain" '$U_DISK' "$disk_usage"
recalc_user_disk_usage
# Logging

View file

@ -14,7 +14,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,39 +24,27 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking stats enabled
is_domain_value_exist 'web' '$STATS'
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
stats=$(get_domain_value 'web' '$STATS')
get_domain_values 'web'
# Checking config
config="$HOMEDIR/$user/conf/web/$stats.$domain.conf"
config="$HOMEDIR/$user/conf/web/$STATS.$domain.conf"
if [ ! -e "$config" ]; then
echo "Error: Parsing error"
log_event 'debug' "$E_PARSING $EVENT"
log_event "$E_PARSING" "$EVENT"
exit $E_PARSING
fi

View file

@ -14,7 +14,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,23 +24,13 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
@ -54,10 +44,8 @@ log_file="/var/log/httpd/domains/$domain.bytes"
bytes=0
# Parsing log
while read line
do
if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]
then
while read line; do
if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]; then
bytes=$(($bytes + $line))
fi
done < $log_file
@ -74,13 +62,13 @@ echo > $log_file
#----------------------------------------------------------#
# Parsing old value
old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
get_domain_values 'web'
# Defining new value
bandwidth=$((old_val + mb))
bandwidth=$((U_BANDWIDTH + mb))
# Updating bandwidth value in config
update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' "$bandwidth"
# Logging
log_event "$OK" "$EVENT"

View file

@ -12,54 +12,33 @@
# Argument defenition
user=$1
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config
conf="$USER_DATA/web.conf"
# 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
# Domain loop
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
home_dir="$HOMEDIR/$user/web/$domain/"
# Checking home directory exist
if [ -e "$home_dir" ]; then
disk_usage=$(nice -n 19 du -shm $home_dir | cut -f 1 )
fi
# Updating disk value in config
update_domain_value 'web' '$U_DISK' "$disk_usage"
update_object_value 'web' 'DOMAIN' "$domain" '$U_DISK' "$disk_usage"
done

View file

@ -12,7 +12,7 @@
# Argument defenition
user=$1
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -22,41 +22,22 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# 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
for domain in $domains; do
stats=$(get_domain_value 'web' '$STATS')
if [ ! -z "$stats" ]; then
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
get_domain_values 'web'
if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
$BIN/v_update_web_domain_stat "$user" "$domain"
rv="$?"
if [ "$rv" -ne '0' ]; then
log_event 'debug' "$rv $EVENT"
exit $rv
fi
fi
done

View file

@ -12,7 +12,7 @@
# Argument defenition
user=$1
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -22,42 +22,19 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user" "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config
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
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
log_file="/var/log/httpd/domains/$domain.bytes"
# Defining bytes
bytes=0
# Parsing log
@ -73,14 +50,11 @@ for domain in $domains; do
# Nulling log
echo > $log_file
# Parsing old value
old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
# Defining new value
bandwidth=$((old_val + mb))
get_domain_values 'web'
bandwidth=$((U_BANDWIDTH + mb))
# Updating bandwidth value in config
update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' "$bandwidth"
done