check_result function

This commit is contained in:
Serghey Rodin 2015-10-28 16:34:41 +02:00
commit 91a804c1c8
66 changed files with 204 additions and 404 deletions

View file

@ -72,11 +72,9 @@ sync_cron_jobs
# Increasing cron value
increase_user_value $user '$U_CRON_JOBS'
# Restart crond
# Restarting crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
# Logging
log_history "added cron job $job"

View file

@ -46,9 +46,7 @@ sync_cron_jobs
# Restart crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
# Logging
log_history "enabled cron reporting"

View file

@ -66,11 +66,9 @@ sync_cron_jobs
# Increasing cron value
increase_user_value $user '$U_CRON_JOBS'
# Restart crond
# Restarting crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
# Logging
log_history "added cron job $job"

View file

@ -161,16 +161,12 @@ fi
# Restarting web server
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
# Restarting proxy server
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
# Restarting firewall

View file

@ -22,18 +22,11 @@ source $VESTA/conf/vesta.conf
if [ ! -e "/usr/sbin/setquota" ]; then
if [ -e "/etc/redhat-release" ]; then
yum -y install quota >/dev/null 2>&1
result=$?
check_result $? "quota package installation failed" $E_UPDATE
else
export DEBIAN_FRONTEND=noninteractive
apt-get -y install quota >/dev/null 2>&1
result=$?
fi
# Checking installation status
if [ "$result" -ne 0 ]; then
echo "Error: quota package wasn't successfully installed"
log_event "$E_UPDATE" "$EVENT"
exit $E_UPDATE
check_result $? "quota package installation failed" $E_UPDATE
fi
fi
@ -66,11 +59,7 @@ chmod a+x /etc/cron.daily/quotacheck
# Enabling fs quota
if [ ! -z "$(quotaon -pa|grep " $mnt "|grep user|grep 'off')" ]; then
quotaon $mnt
if [ $? -ne 0 ]; then
echo "Error: quota can't be enabled on $mnt partition"
log_event "$E_DISK" "$EVENT"
exit $E_DISK
fi
check_result $? "quota can't be enabled in $mtn" $E_DISK
fi
# Updating DISK_QUOTA value

View file

@ -58,11 +58,7 @@ shell=$(grep -w "$shell_conf" /etc/shells |head -n1)
# Adding user
/usr/sbin/useradd "$user" -s "$shell" -c "$email" -m -d "$HOMEDIR/$user"
if [ $? -ne 0 ]; then
echo "Error: user creation failed"
log_event "$E_INVALID" "$EVENT"
exit $E_INVALID
fi
check_result $? "user creation failed" $E_INVALID
# Adding password
echo "$user:$password" | /usr/sbin/chpasswd

View file

@ -213,17 +213,14 @@ str="$str TIME='$TIME' DATE='$DATE'"
# Registering domain
echo "$str" >> $USER_DATA/web.conf
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -75,7 +75,7 @@ if [ "$SSL" = 'yes' ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
del_web_config
@ -100,16 +100,14 @@ update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
# Update counters
increase_user_value "$user" '$U_WEB_ALIASES'
# Adding task to the vesta pipe
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -67,9 +67,7 @@ cat $WEBTPL/$WEB_BACKEND/$template.tpl |\
# Restart backend server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web-backend
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web backend restart failed" >/dev/null
fi
# Logging

View file

@ -100,12 +100,10 @@ fi
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$PROXY"
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions"
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
log_history "enabled proxy support for $domain"

View file

@ -97,7 +97,7 @@ if [ -z "$(grep "$conf" $web_conf)" ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
add_web_config
@ -124,16 +124,14 @@ increase_user_value "$user" '$U_WEB_SSL'
update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
update_object_value 'web' 'DOMAIN' "$domain" '$SSL' "yes"
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -64,11 +64,9 @@ sync_cron_jobs
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
# Logging
log_history "changed cron job $job"

View file

@ -70,12 +70,10 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
fi
# Logging

View file

@ -64,12 +64,10 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
fi
# Logging

View file

@ -90,12 +90,10 @@ fi
update_object_value 'dns' 'DOMAIN' "$domain" '$TPL' "$template"
update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
fi
# Logging

View file

@ -63,12 +63,10 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
fi
# Logging

View file

@ -96,12 +96,10 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
fi
# Logging

View file

@ -70,12 +70,10 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
fi
# Logging

View file

@ -77,9 +77,7 @@ fi
# Restart ftp server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-ftp
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "FTP restart failed" >/dev/null
fi
# Logging

View file

@ -155,16 +155,13 @@ fi
#----------------------------------------------------------#
# Restart web
# Restarting web
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-web-backend
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web backend restart failed" >/dev/null
fi
# Logging

View file

@ -59,17 +59,17 @@ if [ "$SSL" = 'yes' ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
replace_web_config
fi
# Checking SSL proxy
if [ "$SSL" = 'yes' ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
replace_web_config
# Checking SSL proxy
if [ "$SSL" = 'yes' ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
replace_web_config
fi
fi
@ -87,13 +87,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$IP' "$3"
# Restart web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "WEB restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -87,16 +87,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Update config
# Updating config
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$PROXY"
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions"
# Restart web
# Restarting proxy
if [ "$restart" != 'no' ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
# Logging

View file

@ -1,6 +1,6 @@
#!/bin/bash
# info: change domain ssl certificate
# options: USER DOMAIN SSL_DIR
# options: USER DOMAIN SSL_DIR [RESTART]
#
# The function changes SSL domain certificate and the key. If ca file present
# it will be replaced as well.
@ -15,6 +15,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ssl_dir=$3
restart=$4
# Includes
source $VESTA/func/main.sh
@ -26,7 +27,7 @@ source $VESTA/conf/vesta.conf
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN SSL_DIR'
check_args '3' "$#" 'USER DOMAIN SSL_DIR [RESTART]'
validate_format 'user' 'domain' 'ssl_dir'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_object_valid 'user' 'USER' "$user"
@ -69,15 +70,15 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart web server
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi
# Logging

View file

@ -10,6 +10,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ssl_home=$3
restart=$4
# Includes
source $VESTA/func/main.sh
@ -21,7 +22,7 @@ source $VESTA/conf/vesta.conf
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN SSL_HOME'
check_args '3' "$#" 'USER DOMAIN SSL_HOME [RESTART]'
validate_format 'user' 'domain'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_object_valid 'user' 'USER' "$user"
@ -55,7 +56,7 @@ esac
replace_web_config
# Checking proxy config
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
replace_web_config
@ -69,15 +70,15 @@ fi
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
# Restart web server
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi
# Logging

View file

@ -93,12 +93,10 @@ fi
# Changing tpl in config
update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template"
# Restart web
# Restarting web
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
fi
# Logging

View file

@ -52,11 +52,9 @@ sync_cron_jobs
# Decreasing cron value
decrease_user_value "$user" '$U_CRON_JOBS'
# Restart crond
# Restarting crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Restart restart failed" >/dev/null
# Logging
log_history "deleted cron job $job"

View file

@ -44,11 +44,9 @@ sync_cron_jobs
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
# Logging
log_history "disabled cron reporting"

View file

@ -51,11 +51,9 @@ sync_cron_jobs
# Decreasing cron value
decrease_user_value "$user" '$U_CRON_JOBS'
# Restart crond
# Restarting crond
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
# Logging
log_event "$OK" "$EVENT"

View file

@ -71,12 +71,10 @@ rm -f $USER_DATA/dns/$domain.conf
decrease_user_value "$user" '$U_DNS_DOMAINS'
decrease_user_value "$user" '$U_DNS_RECORDS' "$records"
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns $restart
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -11,6 +11,7 @@
# Argument defenition
user=$1
restart=$2
# Includes
source $VESTA/func/main.sh
@ -41,10 +42,10 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart named
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -46,9 +46,7 @@ done
# Restart named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -69,12 +69,10 @@ records="$(wc -l $USER_DATA/dns/$domain.conf | cut -f1 -d ' ')"
update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
decrease_user_value "$user" '$U_DNS_RECORDS'
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -123,16 +123,12 @@ fi
# Restarting web server
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
# Restarting proxy server
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
# Restarting firewall

View file

@ -168,18 +168,14 @@ if [ "$SSL" = 'yes' ]; then
decrease_user_value "$user" '$U_WEB_SSL'
fi
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -73,7 +73,7 @@ if [ "$SSL" = 'yes' ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
del_web_config
@ -98,16 +98,14 @@ update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
# Update counters
decrease_user_value "$user" '$U_WEB_ALIASES'
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -52,12 +52,10 @@ rm -f $pool/$backend.conf
# Vesta #
#----------------------------------------------------------#
# Restart backend server
# Restarting backend server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web-backend
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Backend restart failed" >/dev/null
fi
# Logging

View file

@ -87,9 +87,7 @@ fi
# Restart proxy server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
# Logging

View file

@ -48,7 +48,7 @@ tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
del_web_config
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
del_web_config
@ -89,16 +89,14 @@ fi
# Decreasing domain value
decrease_user_value "$user" '$U_WEB_SSL'
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -42,18 +42,14 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -68,12 +68,10 @@ chmod 660 $USER_DATA/dns.conf
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns $restart
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -44,12 +44,10 @@ echo "$data" >> $USER_DATA/dns/$domain.conf
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns $restart
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -47,12 +47,10 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -40,12 +40,10 @@ sync_cron_jobs
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Logging

View file

@ -81,12 +81,10 @@ update_user_value "$user" '$U_DNS_DOMAINS' "$user_domains"
update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns "$restart"
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -82,12 +82,10 @@ update_user_value "$user" '$U_DNS_DOMAINS' "$user_domains"
update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
# Restart named
# Restarting named
if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Bind restart failed" >/dev/null
fi
# Logging

View file

@ -159,18 +159,14 @@ 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"
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
if [ ! -z "$PROXY_SYSTEM" ];then
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -29,14 +29,10 @@ check_args '1' "$#" 'SERVICE'
if [ "$service" != 'iptables' ]; then
service $service start >/dev/null 2>&1
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "$service start failed" $E_RESTART
else
$BIN/v-update-firewall
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "$service start failed" $E_RESTART
fi

View file

@ -29,14 +29,10 @@ check_args '1' "$#" 'SERVICE'
if [ "$service" != 'iptables' ]; then
service $service stop >/dev/null 2>&1
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "$service stop failed" $E_RESTART
else
$BIN/v-stop-firewall
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "$service stop failed" $E_RESTART
fi

View file

@ -46,12 +46,10 @@ sync_cron_jobs
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Logging

View file

@ -41,12 +41,10 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Logging

View file

@ -46,14 +46,6 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
sed -i "s/SUSPENDED='no'/SUSPENDED='yes'/g" $USER_DATA/dns/$domain.conf
increase_user_value "$user" '$SUSPENDED_DNS'
# Restart named
#if [ "$restart" != 'no' ]; then
# $BIN/v-restart-dns
# if [ $? -ne 0 ]; then
# exit $E_RESTART
# fi
#fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -42,14 +42,6 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart dns server
#if [ "$restart" != 'no' ]; then
# $BIN/v-restart-dns
# if [ $? -ne 0 ]; then
# exit $E_RESTART
# fi
#fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -63,14 +63,6 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
#if [ "$restart" != 'no' ]; then
# $BIN/v-restart-dns
# if [ $? -ne 0 ]; then
# exit $E_RESTART
# fi
#fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -73,22 +73,16 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart web server
# Restarting system services
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Changing suspend value

View file

@ -63,41 +63,39 @@ if [ "$SSL" = 'yes' ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
del_web_config
add_web_config
# Checking proxy SSL
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
del_web_config
add_web_config
fi
fi
# Checking proxy SSL
if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
del_web_config
add_web_config
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Update config
# Updating config
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
increase_user_value "$user" '$SUSPENDED_WEB'
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -42,16 +42,14 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -46,12 +46,10 @@ sync_cron_jobs
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Logging

View file

@ -41,12 +41,10 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart crond
# Restarting crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Logging

View file

@ -47,15 +47,6 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_DNS'
sed -i "s/SUSPENDED='yes'/SUSPENDED='no'/g" $USER_DATA/dns/$domain.conf
# Restart named
#if [ "$restart" != 'no' ]; then
# $BIN/v-restart-dns
# if [ $? -ne 0 ]; then
# exit $E_RESTART
# fi
#fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -42,14 +42,6 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart dns server
#if [ "$restart" != 'no' ]; then
# $BIN/v-restart-dns
# if [ $? -ne 0 ]; then
# exit $E_RESTART
# fi
#fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -62,14 +62,6 @@ fi
# Vesta #
#----------------------------------------------------------#
# Restart named
#if [ "$restart" != 'no' ]; then
# $BIN/v-restart-dns
# if [ $? -ne 0 ]; then
# exit $E_RESTART
# fi
#fi
# Logging
log_event "$OK" "$EVENT"

View file

@ -76,21 +76,16 @@ fi
update_user_value "$user" '$SUSPENDED' 'no'
decrease_user_value 'admin' '$SUSPENDED_USERS'
# Restarting system services
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "DNS restart failed" >/dev/null
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Cron restart failed" >/dev/null
fi
# Logging

View file

@ -52,7 +52,7 @@ upd_web_domain_values
del_web_config
add_web_config
# Check SSL
# Checking SSL
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
@ -61,19 +61,19 @@ if [ "$SSL" = 'yes' ]; then
fi
# Checking proxy
if [ ! -z "$PROXY" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
del_web_config
add_web_config
fi
# Checking SSL proxy
if [ ! -z "$PROXY" ] && [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
del_web_config
add_web_config
# Checking proxy SSL
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
del_web_config
add_web_config
fi
fi
@ -81,20 +81,18 @@ fi
# Vesta #
#----------------------------------------------------------#
# Update config
# Updating config
update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_WEB'
# Restart web erver
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -43,16 +43,14 @@ done
# Vesta #
#----------------------------------------------------------#
# Restart web server
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "Web restart failed" >/dev/null
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi

View file

@ -87,9 +87,7 @@ if [ ! -z "$vst_ip_list" ] && [ "$vst_ip_num" -eq '1' ]; then
$BIN/v-rebuild-dns-domains $user no
done
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
check_result $? "dns restart failed" >/dev/null
fi
# No further comparation is needed

View file

@ -42,11 +42,7 @@ if [ -e "/etc/redhat-release" ]; then
# Update vesta package
$yum update $package > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error: $package update failed"
log_event "$E_UPDATE" "$EVENT"
exit $E_UPDATE
fi
check_result $? "$pacakge update failed" $E_UPDATE
else
# Update repo
apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" \
@ -54,11 +50,7 @@ else
# Update vesta package
apt-get install $package -qq > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error: $package update failed"
log_event "$E_UPDATE" "$EVENT"
exit $E_UPDATE
fi
check_result $? "$pacakge update failed" $E_UPDATE
fi