Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 157212

Summary: postgres init script does not support configuration of postgres with syslog logging [PATCH]
Product: Gentoo Linux Reporter: Mike Mattie <codermattie>
Component: New packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Mike Mattie 2006-12-05 05:26:14 UTC
I configured postgres to log through syslog. Unfortunately the postgres init
script is hard-coded for postgres logging only. when a empty string is passed
to pg_ctl with the -l option postgres fails to start.

I made a simple patch to the init script that supports syslog as an example. I
tested it in the syslog configuration and postgres now starts correctly. I
did not test with regular postgres logging.

--- /etc/init.d/postgresql.backup       2006-12-05 05:14:32.000000000 -0800
+++ /etc/init.d/postgresql      2006-12-05 05:18:40.000000000 -0800
@@ -26,7 +26,13 @@
                rm -f "$PGDATA/postmaster.pid"
        fi

-       su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'"
+        LOG_ARGS="";
+
+       if [ "$PGLOG" != "syslog" ] ; then
+                LOG_ARGS="-l \'$PGLOG\'"
+        fi
+
+       su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s $LOG_ARGS -o '$PGOPTS'"

        while :
        do
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-12-05 11:53:24 UTC

*** This bug has been marked as a duplicate of 44468 ***