2023-10-10 12:40:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
source /opt/scripts/restic/restic.env
|
2023-10-10 18:28:50 +02:00
|
|
|
source /opt/scripts/restic/restic_db_passwords.env
|
|
|
|
|
2023-10-10 12:40:22 +02:00
|
|
|
#We will have to find out whether or not we need to initialize the repo. A non-zero exit code indicates that it has not yet been initialized.
|
|
|
|
restic snapshots
|
|
|
|
if [ "$?" -eq "0" ]
|
|
|
|
then
|
|
|
|
echo "Repo is already initialized, no need to do that."
|
|
|
|
else
|
|
|
|
echo "We need to initialize the repo first." && restic init
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Now dumping databases, this might take a while..."
|
|
|
|
set -x
|
|
|
|
docker exec -t pretix_pg-sql.server2 pg_dumpall -c -U prtxdb > /opt/db_dumps/db-dump-pretix_db.sql
|
|
|
|
source /opt/scripts/restic/restic_db_passwords.env
|
2023-10-10 18:28:50 +02:00
|
|
|
docker exec -t engel_sql.server2 sh -c "exec mysqldump --all-databases -uroot --password=$MARIADB_PASSWORD_ENGELSYSTEM" > /opt/db_dumps/db-dump-engelsystem_db.sql
|
|
|
|
|
2023-10-10 12:40:22 +02:00
|
|
|
set +x
|
|
|
|
|
|
|
|
restic backup --verbose \
|
|
|
|
/etc \
|
|
|
|
/home \
|
|
|
|
/opt \
|
|
|
|
/root \
|
|
|
|
/srv \
|
|
|
|
/var/lib/docker/volumes/ \
|
|
|
|
/var/www
|
|
|
|
|
|
|
|
echo "done! :)"
|