Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Sep 2012 07:37:36 GMT
From:      Dmitry <dmitry2004@yandex.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/172110: databases/postgresql92-server change periodic script [patch]
Message-ID:  <201209270737.q8R7baOd029247@red.freebsd.org>
Resent-Message-ID: <201209270740.q8R7e253005144@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         172110
>Category:       ports
>Synopsis:       databases/postgresql92-server change periodic script [patch]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 27 07:40:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry
>Release:        9.1-PRERELEASE
>Organization:
-
>Environment:
FreeBSD *** 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240914: *** root@***:/usr/obj/usr/src/sys/GENERIC_ amd64
>Description:
periodic script not allow configure pgsql user and port
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- files/502.pgsql.in.orig	2011-10-18 15:03:32.000000000 +0600
+++ files/502.pgsql.in	2012-09-26 17:48:27.000000000 +0600
@@ -19,14 +19,6 @@
 # daily_pgsql_backup_enable="foo bar db1 db2" # only do backup of a limited selection of databases
 # daily_pgsql_vacuum_enable="YES" # do vacuum
 
-daily_pgsql_user=%%PG_USER%%
-daily_pgsql_vacuum_args="-U ${daily_pgsql_user} -qaz"
-daily_pgsql_pgdump_args="-U ${daily_pgsql_user} -bF c"
-daily_pgsql_pgdumpall_globals_args="-U ${daily_pgsql_user}"
-# backupdir is relative to ~pgsql home directory unless it begins with a slash:
-daily_pgsql_backupdir="~${daily_pgsql_user}/backups"
-daily_pgsql_savedays="7"
-
 # If there is a global system configuration file, suck it in.
 #
 if [ -r /etc/defaults/periodic.conf ]
@@ -35,6 +27,15 @@
     source_periodic_confs
 fi
 
+daily_pgsql_user=${daily_pgsql_user:-"%%PG_USER%%"}
+daily_pgsql_port=${daily_pgsql_port:-"5432"}
+daily_pgsql_vacuum_args="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -qaz"
+daily_pgsql_pgdump_args="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -bF c"
+daily_pgsql_pgdumpall_globals_args="-U ${daily_pgsql_user} -p ${daily_pgsql_port}"
+# backupdir is relative to ~pgsql home directory unless it begins with a slash:
+daily_pgsql_backupdir="~${daily_pgsql_user}/backups"
+daily_pgsql_savedays="7"
+
 # allow '~´ in dir name
 eval backupdir=${daily_pgsql_backupdir}
 
@@ -82,7 +83,7 @@
 
 case "$daily_pgsql_backup_enable" in
     [Yy][Ee][Ss])
-	dbnames=`su -l %%PG_USER%% -c "umask 077; psql -q -t -A -d template1 -U %%PG_USER%% -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"`
+	dbnames=`su -l ${daily_pgsql_user} -c "umask 077; psql -U ${daily_pgsql_user} -p ${daily_pgsql_port} -q -t -A -d template1 -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"`
 	pgsql_backup $dbnames
 	;;
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209270737.q8R7baOd029247>