]> git.parisson.com Git - telemeta.git/commitdiff
make restore_db universal, add doc
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 26 Jan 2016 10:55:27 +0000 (11:55 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 26 Jan 2016 10:55:27 +0000 (11:55 +0100)
README.rst
data/backup/restore_db.sh

index df0ec0c9ce9429cdd93d0c15b9d1b96ab4e672c4..c7f6a7f7ccfbfeb629c6249d1381743af358b8e9 100644 (file)
@@ -123,6 +123,20 @@ First install `Git <http://git-scm.com/downloads>`_, `Docker <https://docs.docke
 You can now browse http://localhost:8000 to get the web interface.
 
 
+Restore / backup
+================
+
+To restore a backuped database, put your backup file in data/backup, then in another terminal::
+
+    docker-compose run db /srv/backup/restore_db.sh FILENAME
+
+where FILENAME is the backup filename (can be .sql or .sql.gz)
+
+To backup the database, just run in another terminal::
+
+    docker-compose run db /srv/backup/backup_db.sh
+
+
 API / Documentation
 ====================
 
index 1bf4eb3ff672e62001a89a42dfdb846ddb797085..8666bf8cf05a2828cae2aca8dae99ef89e2c3cef 100755 (executable)
@@ -1,3 +1,10 @@
 #!/bin/bash
 
-gunzip < /srv/backup/$1 | mysql -hdb -uroot -pmysecretpassword telemeta
+file=$1
+
+if [[ $file == *".gz" ]]; then
+    echo 'ok'
+    gunzip < /srv/backup/$file | mysql -hdb -uroot -pmysecretpassword telemeta
+else
+    mysql -hdb -uroot -pmysecretpassword telemeta < /srv/backup/$file
+fi