diff options
| author | cassio <cassiopc@gmail.com> | 2014-08-26 07:33:49 +0000 |
|---|---|---|
| committer | cassio <cassiopc@gmail.com> | 2014-08-26 07:33:49 +0000 |
| commit | 6a532dd4e6b853ea3c8e5694f57295e8a3b191f7 (patch) | |
| tree | ce63caeeb60be6ac7027665d19a0232bc5a8e31a /tools/dump.sh | |
| parent | a36325e95bfd75af9c37b9e0eac6dcf1028a6f61 (diff) | |
| download | boca-6a532dd4e6b853ea3c8e5694f57295e8a3b191f7.tar.gz boca-6a532dd4e6b853ea3c8e5694f57295e8a3b191f7.zip | |
few minor fixes and possibility of having a hotstandby bkp
Diffstat (limited to 'tools/dump.sh')
| -rwxr-xr-x | tools/dump.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/dump.sh b/tools/dump.sh new file mode 100755 index 0000000..f3f3282 --- /dev/null +++ b/tools/dump.sh @@ -0,0 +1,27 @@ +#!/bin/bash +if [ "`id -u`" != "0" ]; then + echo "Must be run as root" + exit 1 +fi +bocadir=/var/www/boca +[ -r /etc/boca.conf ] && . /etc/boca.conf + +for i in pg_dump grep cut gzip date; do + if [ "`which $i`" == "" ]; then + echo "$i executable is not in the PATH. Aborting" + exit 1 + fi +done +da=`date +%d%b%Y-%Hh%Mmin` +echo "I will create the file `pwd`/bocadb.$da.tar.gz" +f=$bocadir/src/private/conf.php +[ -r $f ] || f=$bocadir/src/private/conf.php +if [ -r $f ]; then + echo I believe the password is `grep "\$conf\[\"dbpass\"\]=" $bocadir/src/private/conf.php | cut -d'"' -f4` +else + echo "The password can be found in private/conf.php of the boca directory" +fi +pg_dump -f bocadb.$da.tar -Ft -b -h 127.0.0.1 -U bocauser bocadb +gzip -9 bocadb.$da.tar + +exit 0 |