Fix backup

This commit is contained in:
MadeITBelgium 2017-09-23 15:09:27 +00:00
commit 37a2525ab0
2 changed files with 85 additions and 26 deletions

View file

@ -147,34 +147,82 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
conf="$USER_DATA/web.conf" conf="$USER_DATA/web.conf"
grep "DOMAIN='$domain'" $conf > vesta/web.conf grep "DOMAIN='$domain'" $conf > vesta/web.conf
# Backup vhost config if [ ! -z "$IP" ]; then
tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl" old="$IP"
conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf" # Backup vhost config
get_web_config_lines $tpl_file $conf tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
sed -n "$top_line,$bottom_line p" $conf > conf/$WEB_SYSTEM.conf conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
# Backup ssl vhost
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
get_web_config_lines $tpl_file $conf get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf > conf/s$WEB_SYSTEM.conf sed -n "$top_line,$bottom_line p" $conf > conf/$WEB_SYSTEM.conf
# Backup ssl vhost
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf > conf/s$WEB_SYSTEM.conf
fi
# Backup proxy config
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf > conf/$PROXY_SYSTEM.conf
fi
# Backup ssl proxy config
if [ ! -z "$PROXY_SYSTEM" ] && [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf > conf/s$PROXY_SYSTEM.conf
fi
fi fi
# Backup proxy config if [ ! -z "$IP6" ]; then
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then if [ -z "$IP" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl" echo "" > conf/$WEB_SYSTEM.conf
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf" if [ "$SSL" = 'yes' ]; then
echo "" > conf/s$WEB_SYSTEM.conf
fi
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
echo "" > conf/$PROXY_SYSTEM.conf
fi
if [ ! -z "$PROXY_SYSTEM" ] && [ "$SSL" = 'yes' ]; then
echo > conf/s$PROXY_SYSTEM.conf
fi
fi
old=$IP6
# Backup vhost config
tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.tpl"
conf="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.conf"
get_web_config_lines $tpl_file $conf get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf > conf/$PROXY_SYSTEM.conf sed -n "$top_line,$bottom_line p" $conf >> conf/$WEB_SYSTEM.conf
fi
# Backup ssl proxy config # Backup ssl vhost
if [ ! -z "$PROXY_SYSTEM" ] && [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl" tpl_file="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$TPL.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf" conf="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.conf"
get_web_config_lines $tpl_file $conf get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf > conf/s$PROXY_SYSTEM.conf sed -n "$top_line,$bottom_line p" $conf >> conf/s$WEB_SYSTEM.conf
fi
# Backup proxy config
if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf >> conf/$PROXY_SYSTEM.conf
fi
# Backup ssl proxy config
if [ ! -z "$PROXY_SYSTEM" ] && [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
get_web_config_lines $tpl_file $conf
sed -n "$top_line,$bottom_line p" $conf >> conf/s$PROXY_SYSTEM.conf
fi
fi fi
# Backup custom config # Backup custom config

View file

@ -492,13 +492,16 @@ if [ "$dns" != 'no' ] && [ ! -z "$DNS_SYSTEM" ]; then
old_ip=$IP old_ip=$IP
IP=$ip IP=$ip
fi fi
# Checking ipv6 address # Checking ipv6 address
check_ipv6=$(is_ipv6_valid $IP6 $user) check_ipv6=$(is_ipv6_valid $IP6 $user)
if [ ! -z "$check_ipv6" ]; then if [ ! -z "$check_ipv6" ]; then
local_ip6='' local_ip6=''
get_user_ipv6 $user get_user_ipv6 $user
old_ipv6=$IP6 old_ipv6=$IP6
IP=$ipv6 IP6=$ipv6
else
old_ipv6=''
fi fi
# Checking dns template # Checking dns template
@ -516,6 +519,14 @@ if [ "$dns" != 'no' ] && [ ! -z "$DNS_SYSTEM" ]; then
# Restoring dns records # Restoring dns records
cp -f $tmpdir/dns/$domain/vesta/$domain.conf $USER_DATA/dns/ cp -f $tmpdir/dns/$domain/vesta/$domain.conf $USER_DATA/dns/
if [ -z "$old_ipv6" ] && [ ! -z "$IP6" ]; then
time_n_date=$(date +'%T %F')
time=$(echo "$time_n_date" |cut -f 1 -d \ )
date=$(echo "$time_n_date" |cut -f 2 -d \ )
ip=""
ipv6="$IP6"
add_dns_config_records
fi
# Rebuilding dns domain # Rebuilding dns domain
rebuild_dns_domain_conf rebuild_dns_domain_conf