30 lines
1.1 KiB
Text
30 lines
1.1 KiB
Text
|
#!/bin/bash
|
||
|
source /opt/scripts/restic/restic.env
|
||
|
#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
|
||
|
#docker exec docker-partkeepr-database-1 sh -c "exec mariadb-dump --all-databases -u{{ unhb4_mariadb_containers['partkeepr'].user }} --password=$MARIADB_PASSWORD_PARTKEEPR" > /opt/db_dumps/db-dump-partkeepr_db.sql
|
||
|
source /opt/scripts/restic/restic_db_passwords.env
|
||
|
docker exec -t engel_sql.server2 sh -c "exec mysqldump --all-databases -u{{ unhb4_mariadb_containers['engelsystem'].user }} --password=$MARIADB_PASSWORD_ENGELSYSTEM" > /opt/db_dumps/db-dump-engelsystem_db.sql
|
||
|
set +x
|
||
|
|
||
|
restic backup --verbose \
|
||
|
/etc \
|
||
|
/home \
|
||
|
/opt \
|
||
|
/root \
|
||
|
/srv \
|
||
|
/var/lib/docker/volumes/ \
|
||
|
/var/www
|
||
|
|
||
|
echo "done! :)"
|