fix db backup script
This commit is contained in:
parent
d1d64b181a
commit
1ced0d8b24
@ -1,16 +1,27 @@
|
||||
#!/bin/bash
|
||||
# copy do db mount, use as helper
|
||||
# dump sql db backups
|
||||
#
|
||||
|
||||
if [[ -z $1 ]] ; then
|
||||
echo "dbbu.sh <gitea|flask> <rootpass>"
|
||||
echo "dbbu.sh <gitea|flask|all>"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $1 == "gitea" ]] ; then
|
||||
mariadb-dump -uroot -p$2 gitea > gitea_bu_$(date +%s).sql
|
||||
source ../.env
|
||||
source .env
|
||||
|
||||
TIMESTAMP=$(date +%s)
|
||||
|
||||
if [[ $1 == "gitea" || $1 == "all" ]] ; then
|
||||
docker-compose exec db bash -c "mariadb-dump -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD gitea > /bu/gitea_bu_$TIMESTAMP.sql"
|
||||
docker-compose exec db chmod a+rw /bu/gitea_bu_$TIMESTAMP.sql
|
||||
docker-compose exec db chown ubuntu:ubuntu /bu/gitea_bu_$TIMESTAMP.sql
|
||||
fi
|
||||
|
||||
if [[ $1 == "flask" ]] ; then
|
||||
mariadb-dump -uroot -p$2 flask > flask_bu_$(date +%s).sql
|
||||
if [[ $1 == "flask" || $1 == "all" ]] ; then
|
||||
docker-compose exec db echo $DOTENV_MYSQL_ROOT_PASSWORD
|
||||
docker-compose exec db bash -c "mariadb-dump -uroot -p$DOTENV_MYSQL_ROOT_PASSWORD flask > /bu/flask_bu_$TIMESTAMP.sql"
|
||||
docker-compose exec db chmod a+rw /bu/flask_bu_$TIMESTAMP.sql
|
||||
docker-compose exec db chown ubuntu:ubuntu /bu/flask_bu_$TIMESTAMP.sql
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user