Skip to content
Snippets Groups Projects

Ajout de backup.sh

Merged
Elian Lorauxrequested to merge
services-desk-183-backup into main
5 open threads
1 file
+ 13
6
Compare changes
  • Side-by-side
  • Inline
+ 13
6
#!/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"
Loading