[2e23dc]: / dist / bin / build-dump-pack-database-postgresql.sh  Maximize  Restore  History

Download this file

50 lines (41 with data), 842 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# bbou@ac-toulouse.fr
# 25/11/2013
dbtag=$1
shift
if [ -z "${dbtag}" ]; then
echo "$0 <dbtag:30|31|31_snapshot>"
exit 1
fi
if [ -z "$PGPASSWORD" ]; then
PGPASSWORD=$1
shift
if [ -z "$PGPASSWORD" ]; then
read -s -p "enter postgres's password: " PGPASSWORD
echo
export PGPASSWORD
fi
fi
# D A T A B A S E
db="wordnet${dbtag}"
dbms='postgresql'
# D I R S
distdir="`dirname $(readlink -m $0)`/"
distdir="$(readlink -m ${distdir}/..)"
echo "distdir=${distdir}"
builderdir=${distdir}/../run
builderdir="$(readlink -m ${builderdir})"
echo "builderdir=${builderdir}"
# M A I N
# build
echo "build ${db}"
cd ${builderdir}/bin
./build-${dbms}.sh ${dbtag} $PGPASSWORD
# dump
echo "dump ${db}"
cd ${distdir}
./dump-${dbms}.sh --schema ${dbtag} $PGPASSWORD
# pack
echo "pack ${db}"
cd ${distdir}
./pack.sh ${dbms} ${dbtag}