Package: rsnapshot
Version: 1.3.0-2
Severity: normal
Tags: patch

Hi,

Debian postgresql uses a privilege model whereby the postgres user is 
responsible
for database administration.  The backup_pgsql.sh script included with rsnapshot
doesn't work out of the box.  I've attached a little patch which I hope you find
useful, if raw.

Antony

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages rsnapshot depends on:
ii  logrotate                     3.7.1-3    Log rotation utility
ii  perl                          5.10.0-14  Larry Wall's Practical Extraction 
ii  rsync                         3.0.3-2    fast remote file copy program (lik

Versions of packages rsnapshot recommends:
ii  ssh                           1:5.1p1-2  secure shell client and server (me

rsnapshot suggests no packages.

-- no debconf information
--- /usr/share/doc/rsnapshot/examples/utils/backup_pgsql.sh     2005-04-03 
14:52:03.000000000 +0100
+++ /usr/local/sbin/backup_pgsql.sh     2008-09-24 21:15:39.000000000 +0100
@@ -5,16 +5,14 @@
 #
 # by Nathan Rosenquist <[EMAIL PROTECTED]>
 # http://www.rsnapshot.org/
+# 
+# Debian modifications by Antony Gelberg <[EMAIL PROTECTED]>
 #
 # This is a simple shell script to backup a PostgreSQL database with rsnapshot.
 #
 # The assumption is that this will be invoked from rsnapshot. Also, since it
-# will run unattended, the user that runs rsnapshot (probably root) should have
-# a .pgpass file in their home directory that contains the password for the
-# postgres user. For example:
-#
-# /root/.pgpass (chmod 0600)
-#   *:*:*:postgres:thepassword
+# will run unattended, the user that runs rsnapshot (probably root) must su
+# to Debian's postgres user. 
 #
 # This script simply needs to dump a file into the current working directory.
 # rsnapshot handles everything else.
@@ -23,7 +21,11 @@
 # $Id: backup_pgsql.sh,v 1.5 2005/04/03 13:52:03 scubaninja Exp $
 
 # backup the database
-/usr/local/pgsql/bin/pg_dumpall -Upostgres > pg_dumpall.sql
+su -c 'pg_dumpall > ~/pg_dumpall.sql' postgres
 
 # make the backup readable only by root
-/bin/chmod 600 pg_dumpall.sql
+chown root.root ~postgres/pg_dumpall.sql
+chmod 600 ~postgres/pg_dumpall.sql
+
+# Move the backup to current working directory
+mv ~postgres/pg_dumpall.sql `pwd`

Reply via email to