mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-21 04:50:10 -08:00
75 lines
2.0 KiB
Bash
Executable File
75 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: delete web domain statistics
|
|
# options: USER DOMAIN
|
|
#
|
|
# The function of deleting site's system of statistics. Its type is
|
|
# automatically chooses from client's configuration file.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
domain=$2
|
|
domain_idn=$2
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/func/domain.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
# Additional argument formatting
|
|
format_domain
|
|
format_domain_idn
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'USER DOMAIN'
|
|
is_format_valid '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_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS'
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Defining statistic type
|
|
get_domain_values 'web'
|
|
|
|
# Defining statistic dir
|
|
stats_dir="$HOMEDIR/$user/web/$domain/stats"
|
|
|
|
# Deleting dir content
|
|
rm -rf $stats_dir/*
|
|
|
|
# Deleting config
|
|
rm -f /etc/awstats/$STATS.$domain_idn.conf
|
|
rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Deleting pipe command
|
|
sed -i "/ $domain$/d" $VESTA/data/queue/webstats.pipe
|
|
|
|
# Update config
|
|
update_object_value 'web' 'DOMAIN' "$domain" '$STATS' ''
|
|
|
|
# Logging
|
|
log_history "disabled web log analyzer for $domain"
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|