aboutsummaryrefslogtreecommitdiff
path: root/backupninja/backupninja-0.9.4.diff
blob: 0e64bbbda5a4c8e53ea0fe50a7f6e942faf2345e (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
diff -Naur backupninja-0.9.4.orig/handlers/pgsql backupninja-0.9.4/handlers/pgsql
--- backupninja-0.9.4.orig/handlers/pgsql	2006-10-07 01:45:20.000000000 -0300
+++ backupninja-0.9.4/handlers/pgsql	2006-11-02 17:28:25.000000000 -0200
@@ -7,6 +7,7 @@
 getconf databases all
 getconf compress yes
 getconf vsname
+getconf pgsqluser postgres
 
 localhost=`hostname`
 
@@ -62,12 +63,12 @@
 # give backup dir the good uid and permissions
 # (in respect to the vserver, if $usevserver = yes)
 if [ $usevserver = yes ]; then
-   pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | awk -F: '{print $3}'`
+   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 +78,15 @@
 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 +107,15 @@
     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"