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 #!/bin/bash
echo "Backing up Keycloak DB and config" 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 if [ -z "$MARIADB_PASS" ]; then
echo "Error: the MARIADB_PASS variable is not set or is empty." echo "Error: the MARIADB_PASS variable is not set or is empty."
exit 1 exit 1
fi fi
if [ ! -d "backups" ]; then mkdir -p $DIR/backups`
mkdir "backups"
fi
out="backups/keycloak_$(date +%Y%m%d_%H%M).tar.gz" out="$DIR/backups/keycloak_$(date +%Y%m%d_%H%M).tar.gz"
. .env
if command -v docker-compose &> /dev/null; then if command -v docker-compose &> /dev/null; then
DOCKER_COMPOSE="docker-compose" 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