Skip to content
Snippets Groups Projects
Commit 83fcfe09 authored by Elian Loraux's avatar Elian Loraux
Browse files

Source .env with check, use -p for mkdir and check actual directory

parent 0a95afc4
No related branches found
No related tags found
1 merge request!5Ajout de backup.sh
#!/bin/bash
echo "Backing up Keycloak DB and config"
DIR=$(realpath $(dirname $0))
if [ ! -e $DIR/.env ]
then
echo ".env file do not exist"
exit 1
fi
. $DIR/.env
if [ -z "$MARIADB_PASS" ]; then
echo "Error: the MARIADB_PASS variable is not set or is empty."
exit 1
fi
if [ ! -d "backups" ]; then
mkdir "backups"
fi
mkdir -p $DIR/backups`
out="backups/keycloak_$(date +%Y%m%d_%H%M).tar.gz"
. .env
out="$DIR/backups/keycloak_$(date +%Y%m%d_%H%M).tar.gz"
if command -v docker-compose &> /dev/null; then
DOCKER_COMPOSE="docker-compose"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment