7878# Addding backup and vesta version
7979echo " 1.0" > $tmpdir /backup_version
8080echo " $VERSION " > $tmpdir /vesta_version
81+ vst=' yes'
8182
8283# Vesta
8384if [ -z " $output " ]; then
@@ -205,14 +206,14 @@ then
205206 echo -e " \t$( date +%H:%M:%S) $domain "
206207 fi
207208
209+ # Building directory tree
210+ mkdir -p $tmpdir /web/$domain /conf
211+ mkdir -p $tmpdir /web/$domain /ssl
212+
208213 # Defining domain variables
209214 domain_idn=$( idn -t --quiet -a " $domain " )
210- tpl_name=$( get_web_domain_value ' $TPL' )
211- ssl_cert=$( get_web_domain_value ' $SSL_CERT' )
212- nginx=$( get_web_domain_value ' $NGINX' )
215+ get_web_domain_values
213216
214- # Building directory tree
215- mkdir -p $tmpdir /web/$domain /conf $tmpdir /web/$domain /cert
216217
217218 # Packing data folders
218219 cd $V_HOME /$user /web/$domain
@@ -227,30 +228,30 @@ then
227228 # Apache config
228229 if [ " $WEB_SYSTEM " = ' apache' ]; then
229230 # Parsing httpd.conf
230- tpl_file=" $V_WEBTPL /apache_$tpl_name .tpl"
231+ tpl_file=" $V_WEBTPL /apache_$TPL .tpl"
231232 conf=" $V_HOME /$user /conf/httpd.conf"
232233 get_web_config_brds
233234 sed -n " $top_line ,$bottom_line p" $conf > conf/httpd.conf
234235
235236 # SSL check
236- if [ ! -z " $ssl_cert " ]; then
237- tpl_file=" $V_WEBTPL /apache_$tpl_name .stpl"
237+ if [ ! -z " $SSL " ]; then
238+ tpl_file=" $V_WEBTPL /apache_$TPL .stpl"
238239 conf=" $V_HOME /$user /conf/shttpd.conf"
239240 get_web_config_brds
240241 sed -n " $top_line ,$bottom_line p" $conf > conf/shttpd.conf
241242 fi
242243 fi
243244
244245 # Nginx config
245- if [ ! -z " $nginx " ] ; then
246- tpl_file=" $V_WEBTPL /ngingx_vhost_$nginx .tpl"
246+ if [ ! -z " $NGINX " ] ; then
247+ tpl_file=" $V_WEBTPL /ngingx_vhost_$NGINX .tpl"
247248 conf=" $V_HOME /$user /conf/nginx.conf"
248249 get_web_config_brds
249250 sed -n " $top_line ,$bottom_line p" $conf > conf/nginx.conf
250251
251252 # SSL check
252- if [ ! -z " $ssl_cert " ] ; then
253- tpl_file=" $V_WEBTPL /ngingx_vhost_$nginx .stpl"
253+ if [ ! -z " $SSL " ] ; then
254+ tpl_file=" $V_WEBTPL /ngingx_vhost_$NGINX .stpl"
254255 conf=" $V_HOME /$user /conf/snginx.conf"
255256 get_web_config_brds
256257 sed -n " $top_line ,$bottom_line p" $conf > conf/snginx.conf
@@ -263,11 +264,11 @@ then
263264 done
264265
265266 # SSL Certificates
266- if [ ! -z " $ssl_cert " ] ; then
267- cp $V_HOME /$user /conf/$ssl_cert .* cert /
267+ if [ ! -z " $SSL " ] ; then
268+ cp $V_HOME /$user /conf/$SSL .* ssl /
268269 fi
269270
270- tar -rf $tmpdir /web/$domain /$domain .tar conf cert
271+ tar -rf $tmpdir /web/$domain /$domain .tar conf ssl
271272 mv $tmpdir /web/$domain /$domain .tar $tmpdir /web/
272273 rm -rf $tmpdir /web/$domain
273274
319320 grep " DOMAIN='$domain '" $conf > dns.conf
320321
321322 # Backingup dns recods
322- cp $V_USERS /$user /zones /$domain $domain
323+ cp $V_USERS /$user /dns /$domain $domain
323324 cp /etc/namedb/$domain .db $domain .db
324325 done
325326
@@ -379,7 +380,6 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
379380 if [ -z " $output " ]; then
380381 echo
381382 fi
382-
383383fi
384384
385385# Cron jobs
414414# SSL CERTIFICATES
415415if [ ! -z " $WEB_SSL " ] && [ " $WEB_SSL " != ' no' ] && [ " $SSL " != ' *' ]; then
416416 if [ -z " $output " ]; then
417- echo " -- CERTIFICATES --"
417+ echo " -- SSL --"
418418 fi
419- mkdir $tmpdir /cert
419+ mkdir $tmpdir /ssl
420420
421421 # Backingup ssl certificates
422- cert_list=$( ls $V_USERS /$user /cert / | grep " .crt" | \
422+ cert_list=$( ls $V_USERS /$user /ssl / | grep " .crt" | \
423423 sed -e " s/\.crt$//" | \
424424 tr ' \n' ' ' | \
425425 sed -e ' s/ $//' )
426426 for cert in $cert_list ; do
427427 if [ -z " $output " ]; then
428428 echo -e " \t$( date +%H:%M:%S) $cert "
429429 fi
430- cp $V_USERS /$user /cert /$cert .* $tmpdir /cert /
430+ cp $V_USERS /$user /ssl /$cert .* $tmpdir /ssl /
431431 done
432432
433433 if [ -z " $output " ]; then
@@ -500,7 +500,7 @@ local_backup(){
500500# Defining ftp command function
501501ftpc () {
502502 ftp -n $HOST $PORT << EOF
503- quote USER $USER
503+ quote USER $USERNAME
504504 quote PASS $PASSWORD
505505 binary
506506 cd $BPATH
@@ -516,24 +516,18 @@ ftp_backup(){
516516 fi
517517
518518 # Checking config
519- if [ -e " $V_CONF /backup.conf" ]; then
520- ftphost_str=$( grep " TYPE='FTP'" $V_CONF /backup.conf | head -n 1)
521- fi
522-
523- # Parsing config values
524- if [ ! -z " $ftphost_str " ]; then
525- for key in $ftphost_str ; do
526- eval ${key%% =* } =${key#* =}
527- done
528- else
519+ source $V_CONF /ftp.backup.conf
520+ if [ -z " $HOST " ] || [ -z " $USERNAME " ] || [ -z " $PASSWORD " ] || \
521+ [ -z " $BPATH " ]; then
529522 echo " Error: Parsing error"
530523 log_event ' debug' " $E_PARSE_ERROR $V_EVENT "
531524 exit $E_PARSE_ERROR
532525 fi
533526
534527 # Debug info
535528 if [ -z " $output " ]; then
536- echo -e " \t$( date +%H:%M:%S) ftp://$USER @$HOST$BPATH /$user .$V_DATE .tar"
529+ echo -ne " \t$( date +%H:%M:%S) "
530+ echo -e " ftp://$USERNAME @$HOST$BPATH /$user .$V_DATE .tar"
537531 fi
538532
539533 # Checking ftp permission
592586cd /
593587rm -rf $tmpdir
594588
595- # Calcilation run time
589+ # Calculation run time
596590run_time=$(( end_time - start_time))
597591run_time=$(( run_time / 60 ))
598592current_time=$( date +' %H:%M:%S' )
@@ -626,11 +620,12 @@ done
626620# Concatenating string
627621backup_str=" DATE='$V_DATE ' TIME='$current_time ' RUNTIME='$run_time '"
628622backup_str=" $backup_str TYPE='$BACKUP_SYSTEM ' SIZE='$size '"
623+ backup_str=" $backup_str VESTA='$vst '"
629624backup_str=" $backup_str WEB='${web_list// / ,} '"
630625backup_str=" $backup_str DNS='${dns_list// / ,} '"
631626backup_str=" $backup_str MAIL='${mail_list// / ,} '"
632627backup_str=" $backup_str DB='${db_list// / ,} '"
633- backup_str=" $backup_str CERTIFICATES ='${cert_list// / ,} '"
628+ backup_str=" $backup_str SSL ='${cert_list// / ,} '"
634629backup_str=" $backup_str CRON='$cron_list '"
635630echo " $backup_str " >> $V_USERS /$user /backup.conf
636631
0 commit comments