diff --git a/pgpool.init b/pgpool.init index ee791c7..f09b982 100755 --- a/pgpool.init +++ b/pgpool.init @@ -11,6 +11,9 @@ # # v2.2 Devrim GUNDUZ # - New and improved version which has some fixes. +# +# v2.2.5 Devrim GUNDUZ +# - Fix logging. if [ -r /etc/sysconfig/pgpool ]; then . /etc/sysconfig/pgpool @@ -37,6 +40,14 @@ then NAME=${NAME:3} fi +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + # Set defaults for configuration variables PGPOOLENGINE=/usr/bin PGPOOLDAEMON=$PGPOOLENGINE/pgpool @@ -85,7 +96,7 @@ start(){ echo -n "$PGPOOL_START" - $PGPOOLDAEMON -f $PGPOOLCONF $OPTS & >> "$PGPOOLLOG" 2>&1 < /dev/null + $SU -l postgres -c "$PGPOOLDAEMON -f $PGPOOLCONF $OPTS & " >> "$PGPOOLLOG" 2>&1 < /dev/null sleep 2 pid=`pidof -s "$PGPOOLDAEMON"` diff --git a/pgpool.sysconfig b/pgpool.sysconfig index ef8e2e1..221869e 100644 --- a/pgpool.sysconfig +++ b/pgpool.sysconfig @@ -4,3 +4,4 @@ # -d: debug mode. lots of debug information will be printed #OPTS=" -d -n" +OPTS=" -n"