Skip to content
Snippets Groups Projects
Commit f96049ca authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update pgsql + couchdb scripts

parent c232f061
No related branches found
No related tags found
1 merge request!129Db Profiles
...@@ -514,7 +514,7 @@ rc=$rc+$? ...@@ -514,7 +514,7 @@ rc=$rc+$?
if [ $rc -eq 0 ]; then if [ $rc -eq 0 ]; then
echo OK: couchdb2 config was found on this system ... checking requirements for backup ... # echo OK: couchdb2 config was found on this system ... checking requirements for backup ...
j_requireBinary "curl" 1 j_requireBinary "curl" 1
j_requireBinary "couchbackup" 1 j_requireBinary "couchbackup" 1
......
...@@ -55,11 +55,11 @@ function doPgsqlBackup(){ ...@@ -55,11 +55,11 @@ function doPgsqlBackup(){
# prevent could not change directory to "/root": Permission denied # prevent could not change directory to "/root": Permission denied
cd /tmp cd /tmp
sSqlGetDblist="select datname from pg_database where not datistemplate and datallowconn order by datname;" sSqlGetDblist="select datname from pg_database where not datistemplate and datallowconn order by datname;"
for DATABASE in $(su ${PGUSER} -c "psql -At -c '$sSqlGetDblist' postgres" 2>/dev/null) for DATABASE in $(su ${PGUSER} -c "psql ${BACKUP_PARAMS} -At -c '$sSqlGetDblist' postgres" 2>/dev/null)
do do
echo -n "__DB__${SERVICENAME} backup $DATABASE ... " echo -n "__DB__${SERVICENAME} backup $DATABASE ... "
OUTFILE="${BACKUP_TARGETDIR}/$(get_outfile ${DATABASE}).sql" OUTFILE="${BACKUP_TARGETDIR}/$(get_outfile ${DATABASE}).sql"
su ${PGUSER} -c "pg_dump -Fp ${DATABASE} >$OUTFILE" su ${PGUSER} -c "pg_dump ${BACKUP_PARAMS} -Fp ${DATABASE} >$OUTFILE"
fetchrc >/dev/null fetchrc >/dev/null
db._compressDumpfile "$OUTFILE" db._compressDumpfile "$OUTFILE"
...@@ -95,7 +95,7 @@ function restoreByFile(){ ...@@ -95,7 +95,7 @@ function restoreByFile(){
h2 "ensure that database exists ..." h2 "ensure that database exists ..."
color cmd color cmd
su ${PGUSER} -c "psql -c \"CREATE DATABASE ${sMyDb};\"" su ${PGUSER} -c "psql ${BACKUP_PARAMS} -c \"CREATE DATABASE ${sMyDb};\""
fetchrc fetchrc
color reset color reset
...@@ -103,7 +103,7 @@ function restoreByFile(){ ...@@ -103,7 +103,7 @@ function restoreByFile(){
ls -l "${sMyfile}" ls -l "${sMyfile}"
echo "import to database [${sMyDb}]" echo "import to database [${sMyDb}]"
color cmd color cmd
zcat "${sMyfile}" | su ${PGUSER} -c "psql -d ${sMyDb}" zcat "${sMyfile}" | su ${PGUSER} -c "psql ${BACKUP_PARAMS} -d ${sMyDb}"
fetchrc fetchrc
color reset color reset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment