site/other/dbbu.sh

28 lines
835 B
Bash
Raw Normal View History

2024-08-06 16:01:04 +00:00
#!/bin/bash
2024-08-07 13:51:46 +00:00
# dump sql db backups
#
2024-08-06 16:01:04 +00:00
if [[ -z $1 ]] ; then
2024-08-07 13:51:46 +00:00
echo "dbbu.sh <gitea|flask|all>"
2024-08-06 16:01:04 +00:00
exit 0
fi
2024-08-07 13:51:46 +00:00
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
2024-08-06 16:01:04 +00:00
fi
2024-08-07 13:51:46 +00:00
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
2024-08-06 16:01:04 +00:00
fi