diff options
author | intrigeri <intrigeri@boum.org> | 2006-11-01 18:26:41 +0000 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2006-11-01 18:26:41 +0000 |
commit | 6b015afc1ed4d2be5e48e77eea1ca65cbcf69a1e (patch) | |
tree | 2d0988e58e1b5f720f3297b32136e882d33d89a2 /handlers | |
parent | d595bf00cbd1c13eb157edf8d29d4b8fa76220e2 (diff) | |
download | backupninja-6b015afc1ed4d2be5e48e77eea1ca65cbcf69a1e.tar.gz backupninja-6b015afc1ed4d2be5e48e77eea1ca65cbcf69a1e.tar.bz2 |
pgsql: support PGSQLUSER for real (Closes: #396578)
Diffstat (limited to 'handlers')
-rw-r--r-- | handlers/pgsql | 20 | ||||
-rw-r--r-- | handlers/pgsql.helper | 5 |
2 files changed, 15 insertions, 10 deletions
diff --git a/handlers/pgsql b/handlers/pgsql index 1b91624..fb8fa4f 100644 --- a/handlers/pgsql +++ b/handlers/pgsql @@ -64,10 +64,10 @@ fi if [ $usevserver = yes ]; then pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | awk -F: '{print $3}'` else - pguid=`getent passwd postgres | awk -F: '{print $3}'` + pguid=`getent passwd $PGSQLUSER | awk -F: '{print $3}'` fi [ -n "$pguid" ] || \ - fatal "No user called postgres`[ $usevserver = no ] || echo \" on vserver $vsname\"`." + fatal "No user called $PGSQLUSER`[ $usevserver = no ] || echo \" on vserver $vsname\"`." debug "chown $pguid $vroot$backupdir" chown $pguid $vroot$backupdir debug "chmod 700 $vroot$backupdir" @@ -77,15 +77,15 @@ chmod 700 $vroot$backupdir if [ "$databases" == "all" ]; then if [ $usevserver = yes ]; then if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${vsname}.sql.gz\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${vsname}.sql.gz\"" else - execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\"" fi else if [ "$compress" == "yes" ]; then - execstr="su - postgres -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${localhost}-all.sql.gz\"" + execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${localhost}-all.sql.gz\"" else - execstr="su - postgres -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\"" + execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\"" fi fi debug "$execstr" @@ -106,15 +106,15 @@ else for db in $databases; do if [ $usevserver = yes ]; then if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\"" else - execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db | > $backupdir/${db}.sql\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > $backupdir/${db}.sql\"" fi else if [ "$compress" == "yes" ]; then - execstr="su - postgres -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\"" + execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\"" else - execstr="su - postgres -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\"" + execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\"" fi fi debug "$execstr" diff --git a/handlers/pgsql.helper b/handlers/pgsql.helper index 2b05339..8024616 100644 --- a/handlers/pgsql.helper +++ b/handlers/pgsql.helper @@ -96,6 +96,11 @@ $pgsql_databases # if yes, compress the pg_dump/pg_dumpall output. $pgsql_compress +### You can also set the following variables in backupninja.conf: +# PGSQLDUMP: pg_dump path (default: /usr/bin/pg_dump) +# PGSQLDUMPALL: pg_dumpall path (default: /usr/bin/pg_dumpall) +# PGSQLUSER: user running PostgreSQL (default: postgres) + EOF chmod 600 $next_filename |