]> Git — Sourcephile - gargantext.git/blob - bin/backup
Merge remote-tracking branch 'origin/506-dev-tree-search-fix' into dev
[gargantext.git] / bin / backup
1 #!/bin/bash
2
3 # 0 3 * * * pg_dump --dbname=$MYDB | gzip > ~/backup/db/$(date +%Y-%m-%d).psql.gz
4
5 if [[ $1 == "" || $2 == "" ]]
6 then echo "USAGE : ./bin/backup gargantext.ini backup_directory"
7 else
8
9 INIFILE=$1
10
11 getter () {
12 grep $1 $INIFILE | sed "s/^.*= //"
13 }
14
15 USER=$(getter "DB_USER")
16 NAME=$(getter "DB_NAME")
17 PASS=$(getter "DB_PASS")
18 HOST=$(getter "DB_HOST")
19 PORT=$(getter "DB_PORT")
20
21
22 GARGDB="postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"
23
24 #echo "backuping $GARGDB"
25 pg_dump --dbname=$GARGDB | gzip > $2/$(date +%Y-%m-%d).garg_dump.gz
26
27
28 fi