@@ -184,7 +184,7 @@ echo "Start with databases"
184184tput sgr0
185185
186186echo " Get local databases"
187- mysql -e " SHOW DATABASES" > server_dbs
187+ mysql -e " SHOW DATABASES" > server_dbs
188188da_db_list=$( ls -1 backup/ | grep " .conf" )
189189function run_da_db() {
190190 for da_db in $da_db_list ; do
@@ -203,10 +203,10 @@ function run_da_db() {
203203 mysql -e " CREATE DATABASE $db "
204204
205205 # Preprocess the SQL file to remove problematic lines: https://jira.mariadb.org/browse/MDEV-34203
206- grep -vE ' ^/\*!(999999\\-)' " backup/${database_name} .sql" > " backup/${database_name} _processed.sql" 2> /dev/null
206+ grep -vE ' ^/\*!(999999\\-)' " backup/${database_name} .sql" > " backup/${database_name} _processed.sql" 2> /dev/null
207207
208208 # Import the preprocessed SQL file with --force to ignore errors and continue
209- mysql --force " ${db} " < " backup/${database_name} _processed.sql"
209+ mysql --force " ${db} " < " backup/${database_name} _processed.sql"
210210
211211 if [ $? -ne 0 ]; then
212212 tput setaf 1
@@ -227,9 +227,9 @@ function run_da_db() {
227227 echo " udb: $db_user "
228228 echo " Password: ${md5} "
229229
230- echo " DB='$db ' DBUSER='$db_user ' MD5='$md5 ' HOST='localhost' TYPE='mysql' CHARSET='UTF8' U_DISK='0' SUSPENDED='no' TIME='$time ' DATE='$date '" >> /usr/local/hestia/data/users/" $directadmin_user " /db.conf
230+ echo " DB='$db ' DBUSER='$db_user ' MD5='$md5 ' HOST='localhost' TYPE='mysql' CHARSET='UTF8' U_DISK='0' SUSPENDED='no' TIME='$time ' DATE='$date '" >> /usr/local/hestia/data/users/" $directadmin_user " /db.conf
231231 fi
232- done < " backup/${da_db} "
232+ done < " backup/${da_db} "
233233
234234 # Leave Hestia to restore passwords and create users
235235 tput setaf 2
@@ -274,13 +274,13 @@ for directadmin_domain in $directadmin_domain_list; do
274274 tput sgr0
275275 elif [ -d /home/" ${directadmin_user} " /web/" ${directadmin_domain} " ]; then
276276 echo " Domain $directadmin_domain added, restoring files"
277- echo " $directadmin_domain " >> restored_domains
277+ echo " $directadmin_domain " >> restored_domains
278278 rm -f /home/" $directadmin_user " /web/" $directadmin_domain " /public_html/index.html
279279 rm -f /home/" $directadmin_user " /web/" $directadmin_domain " /public_html/robots.txt
280280
281281 public_sync_count=0
282- rsync -av domains/" ${directadmin_domain} " /public_html/ /home/" $directadmin_user " /web/" $directadmin_domain " /public_html 2>&1 |
283- while read file_dm; do
282+ rsync -av domains/" ${directadmin_domain} " /public_html/ /home/" $directadmin_user " /web/" $directadmin_domain " /public_html 2>&1 \
283+ | while read file_dm; do
284284 public_sync_count=$(( $public_sync_count + 1 ))
285285 echo -en " -- $public_sync_count restored files\r"
286286 done
@@ -293,8 +293,8 @@ for directadmin_domain in $directadmin_domain_list; do
293293 else
294294 private_sync_count=0
295295
296- rsync -av domains/" ${directadmin_domain} " /private_html/ /home/" $directadmin_user " /web/" $directadmin_domain " /private 2>&1 |
297- while read file_dm; do
296+ rsync -av domains/" ${directadmin_domain} " /private_html/ /home/" $directadmin_user " /web/" $directadmin_domain " /private 2>&1 \
297+ | while read file_dm; do
298298 private_sync_count=$(( $private_sync_count + 1 ))
299299 echo -en " -- $private_sync_count restored files\r"
300300 done
@@ -334,8 +334,8 @@ if [ -e restored_domains ]; then
334334 tmp_pass=$( generate_password)
335335 " $BIN " /v-add-mail-account " $directadmin_user " " $da_mail_domain " " $da_imap " " $tmp_pass "
336336 if [ " $debug " != 0 ]; then
337- rsync -av imap/" ${da_mail_domain} " /" ${da_imap} " /Maildir/ /home/" ${directadmin_user} " /mail/" ${da_mail_domain} " /" ${da_imap} " 2>&1 |
338- while read backup_file_dm; do
337+ rsync -av imap/" ${da_mail_domain} " /" ${da_imap} " /Maildir/ /home/" ${directadmin_user} " /mail/" ${da_mail_domain} " /" ${da_imap} " 2>&1 \
338+ | while read backup_file_dm; do
339339 sk_sync=$(( sk_sync + 1 ))
340340 echo -en " -- $sk_sync restored files\r"
341341 done
@@ -379,7 +379,7 @@ if [ -f "backup/crontab.conf" ]; then
379379 fi
380380
381381 # Extract cron job details (handle cases where command contains spaces)
382- IFS= ' ' read -r min hour day month wday command <<< " $cron_line "
382+ IFS= ' ' read -r min hour day month wday command <<< " $cron_line "
383383
384384 # Ensure it is a valid cron job line
385385 if ! [[ " $min " =~ ^[\* 0-9,-/]+$ && " $hour " =~ ^[\* 0-9,-/]+$ && " $day " =~ ^[\* 0-9,-/]+$ && " $month " =~ ^[\* 0-9,-/]+$ && " $wday " =~ ^[\* 0-9,-/]+$ ]]; then
@@ -392,7 +392,7 @@ if [ -f "backup/crontab.conf" ]; then
392392
393393 echo " Adding cron job for user $directadmin_user : $cron_line "
394394 " $BIN " /v-add-cron-job " $directadmin_user " " $min " " $hour " " $day " " $month " " $wday " " $command "
395- done < " backup/crontab.conf"
395+ done < " backup/crontab.conf"
396396else
397397 echo " No cron jobs found to restore."
398398fi
@@ -425,7 +425,7 @@ if [ -d "$domain_base_dir" ]; then
425425 else
426426 echo " Skipping non-alias type for $alias_domain : $alias_type "
427427 fi
428- done < " $domain_pointers_file "
428+ done < " $domain_pointers_file "
429429 fi
430430 done
431431else
0 commit comments