Skip to content

Commit 4814e7a

Browse files
authored
Adding call for function wait_for_backup_if_it_is_not_time_for_backup
1 parent 525bd0f commit 4814e7a

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

bin/v-backup-user

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,7 @@ is_backup_enabled
3939
# Action #
4040
#----------------------------------------------------------#
4141

42-
# block backup if current hour is after 6 AM
43-
WAIT_LOOP_ENTERED=0
44-
if pgrep -x "v-backup-users" > /dev/null
45-
then
46-
hour=$(date +"%H");
47-
while [ "$hour" -gt "6" ]; do
48-
if [ "$WAIT_LOOP_ENTERED" -eq 0 ]; then
49-
$BIN/v-restart-web-backend
50-
fi
51-
WAIT_LOOP_ENTERED=1
52-
current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";
53-
echo "$current_date_time - wait for backup user $user - hour $hour";
54-
sleep 300
55-
hour=$(date +"%H");
56-
done
57-
fi
42+
wait_for_backup_if_it_is_not_time_for_backup
5843

5944
# Set backup directory if undefined
6045
if [ -z "$BACKUP" ]; then
@@ -153,6 +138,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
153138
i=0
154139

155140
for domain in $web_list; do
141+
wait_for_backup_if_it_is_not_time_for_backup
156142
((i ++))
157143
echo -e "$(date "+%F %T") $domain" |tee -a $BACKUP/$user.log
158144
mkdir -p $tmpdir/web/$domain/conf
@@ -326,6 +312,7 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
326312

327313
i=0
328314
for domain in $mail_list; do
315+
wait_for_backup_if_it_is_not_time_for_backup
329316
((i ++))
330317
echo -e "$(date "+%F %T") $domain" |tee -a $BACKUP/$user.log
331318
mkdir -p $tmpdir/mail/$domain/conf
@@ -398,6 +385,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB" != '*' ]; then
398385
conf="$USER_DATA/db.conf"
399386
db_list=$(echo "$db_list" |sed -e "s/ */\ /g" -e "s/^ //")
400387
for database in $db_list; do
388+
wait_for_backup_if_it_is_not_time_for_backup
401389
((i ++))
402390
get_database_values
403391

@@ -500,6 +488,8 @@ if [ "$USER" != '*' ]; then
500488
udir_list="$udir_list $udir"
501489
echo -e "$(date "+%F %T") adding $udir" |tee -a $BACKUP/$user.log
502490

491+
wait_for_backup_if_it_is_not_time_for_backup
492+
503493
# Backup files and dirs
504494
tar -cpf- $udir |gzip -$BACKUP_GZIP - > $tmpdir/user_dir/$udir.tar.gz
505495
fi

0 commit comments

Comments
 (0)