forked from openemr/openemr-devops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxbackup-wrapper.sh
36 lines (29 loc) · 908 Bytes
/
xbackup-wrapper.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
exec > /tmp/xtrabackup-launch.log 2>&1
cd /root
# if you recover into a clean system, initial xbackup.sh init was run back then and should not repeat
if [ -f restore-process-complete ]; then
if [ ! -f xtrabackup.database.txt ]; then
echo openemr > xtrabackup.database.txt
chmod 600 xtrabackup.database.txt
fi
touch allsetup.ok
rm restore-process-complete
fi
if [ ! -f allsetup.ok ]; then
./xbackup.sh -u openemr -a && ./xbackup.sh -t full && touch allsetup.ok && exit 0
exit 1
fi
if [ -f force-full-backup ]; then
rm force-full-backup
./xbackup.sh -t full
exit $?
fi
# I don't like forcing it like this, but if the backup fails one day, we need to try it the next
# here's the problem: manual run during an automated run will cause destruction and havoc and woe
if [ $(date +%u) == 7 ]; then
./xbackup.sh -t full -f
else
./xbackup.sh -t incr -f
fi;
exit $?