Skip to content

Commit de2c030

Browse files
committed
backup: refactor: inline for clarity
1 parent 198f878 commit de2c030

File tree

5 files changed

+22
-37
lines changed

5 files changed

+22
-37
lines changed

scripts/backup.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@ fi
8383

8484
echo "" >> $BACKUPLIST
8585

86-
echo "" >> $LOGFILE
87-
echo "Executing prebackup scripts" >> $LOGFILE
88-
bash ./scripts/backup_restore/pre_backup_complete.sh >> $LOGFILE 2>&1
86+
echo "Stopping stack to get consistent database backups" >> $LOGFILE
87+
docker-compose stop >> $LOGFILE
88+
89+
if [ -f "./pre_backup.sh" ]; then
90+
echo "" >> $LOGFILE
91+
echo "./pre_backup.sh file found, executing:" >> $LOGFILE
92+
bash ./pre_backup.sh >> $LOGFILE 2>&1
93+
fi
8994

9095
echo "./services/" >> $BACKUPLIST
9196
echo "./volumes/" >> $BACKUPLIST
@@ -121,9 +126,14 @@ fi
121126
echo "Backup Size (bytes): $(stat --printf="%s" $TMPBACKUPFILE)" >> $LOGFILE
122127
echo "" >> $LOGFILE
123128

124-
echo "Executing postbackup scripts" >> $LOGFILE
125-
bash ./scripts/backup_restore/post_backup_complete.sh >> $LOGFILE 2>&1
126-
echo "" >> $LOGFILE
129+
if [ -f "./post_backup.sh" ]; then
130+
echo "./post_backup.sh file found, executing:" >> $LOGFILE
131+
bash ./post_backup.sh 2>&1 >> $LOGFILE
132+
echo "" > $LOGFILE
133+
fi
134+
135+
echo "Starting stack back up" >> $LOGFILE
136+
docker-compose start
127137

128138
echo "Finished At: $(date +"%Y-%m-%dT%H-%M-%S")" >> $LOGFILE
129139
echo "" >> $LOGFILE

scripts/backup_restore/post_backup_complete.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

scripts/backup_restore/post_restore_complete.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/backup_restore/pre_backup_complete.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

scripts/restore.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ sudo tar -zxvf \
7777

7878
echo "" >> $LOGFILE
7979

80-
echo "Executing post restore scripts" >> $LOGFILE
81-
bash ./scripts/backup_restore/post_restore_complete.sh >> $LOGFILE 2>&1
82-
echo "" > $LOGFILE
80+
81+
if [ -f "./post_restore.sh" ]; then
82+
echo "./post_restore.sh file found, executing:" >> $LOGFILE
83+
bash ./post_restore.sh 2>&1 >> $LOGFILE
84+
echo "" > $LOGFILE
85+
fi
8386

8487
echo "Finished At: $(date +"%Y-%m-%dT%H-%M-%S")" >> $LOGFILE
8588
echo "" >> $LOGFILE

0 commit comments

Comments
 (0)