]> git.parisson.com Git - docker-django-scripts.git/commitdiff
Just use env variables
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 17 Oct 2017 14:09:08 +0000 (16:09 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 17 Oct 2017 14:09:08 +0000 (16:09 +0200)
db/restore.sh

index 0263451758f7635589b2297a61a089b11033d164..3531fe72e73e8edb8c76e0d2b2838608e14ec546 100755 (executable)
@@ -1,14 +1,14 @@
 #!/bin/bash
 
 # import dump functions of the database (postgres or mysql)
-export POSTGRES="$(dpkg --get-selections  | grep postgres 2>&1)"
-export MYSQL="$(dpkg --get-selections  | grep mysql 2>&1)"
+export POSTGRES="$(dpkg --get-selections  | grep postgres 2>&1)"
+export MYSQL="$(dpkg --get-selections  | grep mysql 2>&1)"
 
-if [ ! -z "$MYSQL" ];
+if [ ! -z "$MYSQL_ROOT_PASSWORD" ];
     then
     export MYSQL_PWD=$MYSQL_ROOT_PASSWORD
     mysql -h db $MYSQL_DATABASE -uroot < /srv/backup/mariadb.dump
-elif [ ! -z "$POSTGRES" ];
+elif [ ! -z "$POSTGRES_PASSWORD" ];
     then
     # export PGUSER="postgres"
     export PGPASSWORD=$POSTGRES_PASSWORD