mirror of
https://github.com/myvesta/vesta.git
synced 2025-03-12 04:35:23 -07:00
added mail support in backup system
This commit is contained in:
parent
46e0bc239b
commit
1e34f90db6
@ -133,20 +133,16 @@ then
|
||||
for domain in $web_list; do
|
||||
echo -e "$(date "+%F %T") $domain"
|
||||
mkdir -p $tmpdir/web/$domain/conf
|
||||
mkdir -p $tmpdir/web/$domain/vesta
|
||||
|
||||
# Defining domain variables
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
get_domain_values 'web'
|
||||
|
||||
# Packing data folders
|
||||
cd $HOMEDIR/$user/web/$domain
|
||||
domain_direcotries=$(ls |grep -v logs)
|
||||
tar -cf $tmpdir/web/$domain/$domain.tar $domain_direcotries
|
||||
|
||||
# Creating web.config
|
||||
cd $tmpdir/web/$domain/
|
||||
conf="$USER_DATA/web.conf"
|
||||
grep "DOMAIN='$domain'" $conf > conf/vesta.conf
|
||||
grep "DOMAIN='$domain'" $conf > vesta/web.conf
|
||||
|
||||
# Apache config
|
||||
if [ "$WEB_SYSTEM" = 'apache' ]; then
|
||||
@ -189,16 +185,17 @@ then
|
||||
# SSL Certificates
|
||||
if [ "$SSL" = 'yes' ] ; then
|
||||
cp $HOMEDIR/$user/conf/web/ssl.$domain.* conf/
|
||||
cp $USER_DATA/ssl/$domain.* vesta/
|
||||
fi
|
||||
|
||||
tar -rf $tmpdir/web/$domain/$domain.tar conf
|
||||
mv $tmpdir/web/$domain/$domain.tar $tmpdir/web/
|
||||
rm -rf $tmpdir/web/$domain
|
||||
# Packing data folders
|
||||
cd $HOMEDIR/$user/web/$domain
|
||||
domain_direcotries=$(ls |grep -v logs)
|
||||
tar -cf $tmpdir/web/$domain/domain_data.tar $domain_direcotries
|
||||
|
||||
if [ ! -z "$BACKUP_GZIP" ]; then
|
||||
gzip -$BACKUP_GZIP $tmpdir/web/$domain.tar
|
||||
if [ ! -z "$BACKUP_GZIP" ]; then
|
||||
gzip -$BACKUP_GZIP $tmpdir/web/$domain/domain_data.tar
|
||||
fi
|
||||
|
||||
done
|
||||
echo
|
||||
fi
|
||||
@ -221,23 +218,70 @@ then
|
||||
for domain in $dns_list; do
|
||||
echo -e "$(date "+%F %T") $domain"
|
||||
# Building directory tree
|
||||
mkdir $tmpdir/dns/$domain
|
||||
mkdir -p $tmpdir/dns/$domain/conf
|
||||
mkdir -p $tmpdir/dns/$domain/vesta
|
||||
|
||||
# Creating dns_domains config
|
||||
cd $tmpdir/dns/$domain/
|
||||
conf="$USER_DATA/dns.conf"
|
||||
grep "DOMAIN='$domain'" $conf > dns.conf
|
||||
grep "DOMAIN='$domain'" $conf > vesta/dns.conf
|
||||
|
||||
# Backingup dns recods
|
||||
cp $USER_DATA/dns/$domain.conf $domain.conf
|
||||
cp $HOMEDIR/$user/conf/dns/$domain.db $domain.db
|
||||
cp $USER_DATA/dns/$domain.conf vesta/$domain.conf
|
||||
cp $HOMEDIR/$user/conf/dns/$domain.db conf/$domain.db
|
||||
done
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
# Mail domains
|
||||
# TBD
|
||||
if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ] && [ "$MAIL" != '*' ]
|
||||
then
|
||||
echo "-- MAIL --"
|
||||
mkdir $tmpdir/mail/
|
||||
|
||||
# Parsing unsuspeneded domains
|
||||
conf="$USER_DATA/mail.conf"
|
||||
for domain in $(search_objects 'mail' 'SUSPENDED' "*" 'DOMAIN'); do
|
||||
check_exl=$(echo "$MAIL"|grep -w $domain)
|
||||
if [ -z "$check_exl" ]; then
|
||||
mail_list="$mail_list $domain"
|
||||
fi
|
||||
done
|
||||
mail_list=$(echo "$mail_list" | sed -e "s/ */\ /g" -e "s/^ //")
|
||||
|
||||
for domain in $mail_list; do
|
||||
echo -e "$(date "+%F %T") $domain"
|
||||
#mkdir -p $tmpdir/mail/$domain/accounts
|
||||
mkdir -p $tmpdir/mail/$domain/conf
|
||||
mkdir -p $tmpdir/mail/$domain/vesta
|
||||
|
||||
# Creating exim config
|
||||
cd $tmpdir/mail/$domain/
|
||||
cp $HOMEDIR/$user/conf/mail/$domain/* conf/
|
||||
|
||||
# Creating vesta config
|
||||
conf="$USER_DATA/mail.conf"
|
||||
grep "DOMAIN='$domain'" $conf > vesta/mail.conf
|
||||
cp $USER_DATA/mail/$domain.* vesta/
|
||||
if [ ! -z "$(ls $USER_DATA/mail/|grep *@$domain)" ]; then
|
||||
cp $USER_DATA/mail/*@$domain.* vesta/
|
||||
fi
|
||||
|
||||
# Packing mailboxes
|
||||
cd $HOMEDIR/$user/mail/$domain
|
||||
accounts=$(ls)
|
||||
if [ ! -z "$accounts" ]; then
|
||||
tar -cf $tmpdir/mail/$domain/accounts.tar $accounts
|
||||
fi
|
||||
|
||||
if [ ! -z "$BACKUP_GZIP" ] && [ ! -z $accounts ]; then
|
||||
gzip -$BACKUP_GZIP $tmpdir/mail/$domain/accounts.tar
|
||||
fi
|
||||
done
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
# DatbaBases
|
||||
if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
|
||||
@ -254,9 +298,16 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
|
||||
db_list=$(echo "$db_list" | sed -e "s/ */\ /g" -e "s/^ //")
|
||||
|
||||
for database in $db_list; do
|
||||
mkdir -p $tmpdir/db/$database/conf
|
||||
mkdir -p $tmpdir/db/$database/vesta
|
||||
cd $tmpdir/db/$database/
|
||||
|
||||
conf="$USER_DATA/db.conf"
|
||||
grep "DB='$database'" $conf > vesta/db.conf
|
||||
|
||||
get_database_values
|
||||
dump="$tmpdir/db/$database.$TYPE.sql"
|
||||
grants="$tmpdir/db/$database.$TYPE.$DBUSER"
|
||||
dump="$tmpdir/db/$database/$database.$TYPE.sql"
|
||||
grants="$tmpdir/db/$database/conf/$database.$TYPE.$DBUSER"
|
||||
echo -e "$(date "+%F %T") $database $TYPE"
|
||||
case $TYPE in
|
||||
mysql) dump_mysql_database ;;
|
||||
|
@ -35,9 +35,9 @@ json_list_ips() {
|
||||
else
|
||||
if [ $i -lt $fileds_count ]; then
|
||||
(( ++i))
|
||||
echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
|
||||
echo -e "\t\t\"${field//$/}\": \"$value\","
|
||||
else
|
||||
echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
|
||||
echo -e "\t\t\"${field//$/}\": \"$value\""
|
||||
data=1
|
||||
fi
|
||||
fi
|
||||
@ -75,7 +75,7 @@ shell_list_ips() {
|
||||
# Defining fileds to select
|
||||
conf=$VESTA/data/ips/*
|
||||
fields="\$IP \$OWNER \$STATUS \$NAME \$U_SYS_USERS \$U_WEB_DOMAINS"
|
||||
fields="$fields \$INTERFACE \$NETMASK \$DATE"
|
||||
fields="$fields \$INTERFACE \$NETMASK \$TIME \$DATE"
|
||||
|
||||
# Listing ip addresses
|
||||
case $format in
|
||||
|
@ -191,6 +191,7 @@ create_vesta_ip() {
|
||||
ip_data="$ip_data\nU_WEB_DOMAINS='0'"
|
||||
ip_data="$ip_data\nINTERFACE='$interface'"
|
||||
ip_data="$ip_data\nNETMASK='$mask'"
|
||||
ip_data="$ip_data\nTIME='$TIME'"
|
||||
ip_data="$ip_data\nDATE='$DATE'"
|
||||
echo -e "$ip_data" >$VESTA/data/ips/$ip
|
||||
chmod 660 $VESTA/data/ips/$ip
|
||||
|
Loading…
x
Reference in New Issue
Block a user