Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aEOHz-00057C-IB for pgsql-pkg-yum@arkaria.postgresql.org; Wed, 30 Dec 2015 21:28:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aEOHy-00005I-QS for pgsql-pkg-yum@arkaria.postgresql.org; Wed, 30 Dec 2015 21:28:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aEOHt-0008TU-Uq for pgsql-pkg-yum@postgresql.org; Wed, 30 Dec 2015 21:28:06 +0000 Received: from smtp-out-03c.arnet.com.ar ([200.45.0.212]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aEOHk-0005ml-3v for pgsql-pkg-yum@postgresql.org; Wed, 30 Dec 2015 21:28:05 +0000 X-Arnet-Anti-Spam: Activado X-Arnet-AV: Activado X-IPAS-Result: A2CLBgA5S4RW/wPdqMBeGQEBAQEPAQEBAYMKUm2IWbZEHgqFZwKBFE0BAQEBAQGBC4Q0AQEBAQMaAQgELyMQCw0EAwECChYLAgIJAwIBAgEnFggGDAEGAgEBGIgVri6QegEBAQEBAQQBAQEBAQEUCYtVhHeCfIFJBZcGgnKMO4c9JQyFMY44AmSCERyBdyQ0hRQBAQE Received: from unknown (HELO smtp-client-02.arnet.com.ar) ([192.168.221.3]) by smtp-route-03.arnet.com.ar with ESMTP; 30 Dec 2015 18:27:45 -0300 X-IPAS-Result: A2CWBgBzS4RW/98gXLVegzpSbYhZtkQehXECgRRNAQEBAQEBgQuENAEBAQQaAQgELyMQCxEDAQIKFgsCAgkDAgECAScWCAYMAQYCAQEYiBWuLZB6AQEBAQEBBAEBAQEBARQJi1WEd4J8gUkFlwaCcow7hz0xhTGOOAJkghEcgXckNIUUAQEB Received: from host223.181-92-32.telecom.net.ar (HELO mail.marquesminen.com.ar) ([181.92.32.223]) by smtp-client-02.arnet.com.ar with ESMTP; 30 Dec 2015 18:27:40 -0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.marquesminen.com.ar (Postfix) with ESMTP id C277A120E63; Wed, 30 Dec 2015 18:27:36 -0300 (ART) X-Virus-Scanned: amavisd-new at example.com Received: from mail.marquesminen.com.ar ([127.0.0.1]) by localhost (endor.marques [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tot8wCE9uRqQ; Wed, 30 Dec 2015 18:27:28 -0300 (ART) Received: from alderaan.marques (unknown [192.168.0.44]) by mail.marquesminen.com.ar (Postfix) with ESMTP id CFC1C120CE6; Wed, 30 Dec 2015 18:27:27 -0300 (ART) Subject: Re: repmgr.service To: Jeff Frost References: <56731A29.6080303@2ndquadrant.com> <8DCBFCBE-86BD-46D9-B089-B8FD049C0BA1@pgexperts.com> Cc: Justin King , pgsql-pkg-yum@postgresql.org, Ian Barwick From: =?UTF-8?Q?Mart=c3=adn_Marqu=c3=a9s?= Message-ID: <56844C3F.1060800@2ndquadrant.com> Date: Wed, 30 Dec 2015 18:27:27 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <8DCBFCBE-86BD-46D9-B089-B8FD049C0BA1@pgexperts.com> Content-Type: multipart/mixed; boundary="------------080703020603090509050909" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-pkg-yum Precedence: bulk Sender: pgsql-pkg-yum-owner@postgresql.org This is a multi-part message in MIME format. --------------080703020603090509050909 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit El 22/12/15 a las 23:52, Jeff Frost escribió: > Sorry for the slow reply on this. > > We did make some changes recently, but it seems this was not one of them. > > A patch would definitely speed us up and would be most welcome! > > This is another patch I had pending for a long time which adds some improvements to the old sysV init scripts. I'll try to roll the spec file patch. -- Martín Marqués http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --------------080703020603090509050909 Content-Type: text/x-patch; name="0001-Improvements-to-sysV-init-script-and-the-use-of-s-sy.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Improvements-to-sysV-init-script-and-the-use-of-s-sy.pa"; filename*1="tch" From e4d4b1695c0e04610edde5767a23bdd014b80066 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 30 Dec 2015 18:22:27 -0300 Subject: [PATCH] Improvements to sysV init script and the use of s sysconfig file for extra options the DBA might want to use. --- rpm/redhat/9.0/repmgr/EL-5/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.0/repmgr/EL-5/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.0/repmgr/EL-6/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.0/repmgr/EL-6/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.1/repmgr/EL-5/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.1/repmgr/EL-5/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.1/repmgr/EL-6/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.1/repmgr/EL-6/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.2/repmgr/EL-5/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.2/repmgr/EL-5/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.2/repmgr/EL-6/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.2/repmgr/EL-6/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.2/repmgr/EL-7/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.2/repmgr/EL-7/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.2/repmgr/F-19/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.2/repmgr/F-19/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/EL-5/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/EL-5/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/EL-6/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/EL-6/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/EL-7/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/EL-7/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/F-19/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/F-19/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/F-20/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/F-20/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/F-21/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/F-21/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/F-22/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/F-22/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.3/repmgr/F-23/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.3/repmgr/F-23/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.4/repmgr/EL-5/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.4/repmgr/EL-6/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.4/repmgr/EL-6/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.4/repmgr/EL-7/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.4/repmgr/F-20/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.4/repmgr/F-21/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.4/repmgr/F-22/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.4/repmgr/F-23/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/EL-5/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/EL-5/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.5/repmgr/EL-6/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/EL-6/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.5/repmgr/EL-7/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/EL-7/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.5/repmgr/F-20/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/F-20/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.5/repmgr/F-21/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/F-21/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.5/repmgr/F-22/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/F-22/repmgrd.sysconfig | 24 +++++++++++++++ rpm/redhat/9.5/repmgr/F-23/repmgr.init | 45 +++++++++++++++++++++++----- rpm/redhat/9.5/repmgr/F-23/repmgrd.sysconfig | 24 +++++++++++++++ 54 files changed, 1716 insertions(+), 210 deletions(-) create mode 100644 rpm/redhat/9.0/repmgr/EL-5/repmgrd.sysconfig create mode 100644 rpm/redhat/9.0/repmgr/EL-6/repmgrd.sysconfig create mode 100644 rpm/redhat/9.1/repmgr/EL-5/repmgrd.sysconfig create mode 100644 rpm/redhat/9.1/repmgr/EL-6/repmgrd.sysconfig create mode 100644 rpm/redhat/9.2/repmgr/EL-5/repmgrd.sysconfig create mode 100644 rpm/redhat/9.2/repmgr/EL-6/repmgrd.sysconfig create mode 100644 rpm/redhat/9.2/repmgr/EL-7/repmgrd.sysconfig create mode 100644 rpm/redhat/9.2/repmgr/F-19/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/EL-5/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/EL-6/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/EL-7/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/F-19/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/F-20/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/F-21/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/F-22/repmgrd.sysconfig create mode 100644 rpm/redhat/9.3/repmgr/F-23/repmgrd.sysconfig create mode 100644 rpm/redhat/9.4/repmgr/EL-6/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/EL-5/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/EL-6/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/EL-7/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/F-20/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/F-21/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/F-22/repmgrd.sysconfig create mode 100644 rpm/redhat/9.5/repmgr/F-23/repmgrd.sysconfig diff --git a/rpm/redhat/9.0/repmgr/EL-5/repmgr.init b/rpm/redhat/9.0/repmgr/EL-5/repmgr.init index e00089b..5b5bc6f 100644 --- a/rpm/redhat/9.0/repmgr/EL-5/repmgr.init +++ b/rpm/redhat/9.0/repmgr/EL-5/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.0.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.0/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.0.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.0/repmgr/EL-5/repmgrd.sysconfig b/rpm/redhat/9.0/repmgr/EL-5/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.0/repmgr/EL-5/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.0/repmgr/EL-6/repmgr.init b/rpm/redhat/9.0/repmgr/EL-6/repmgr.init index e00089b..5b5bc6f 100644 --- a/rpm/redhat/9.0/repmgr/EL-6/repmgr.init +++ b/rpm/redhat/9.0/repmgr/EL-6/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.0.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.0/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.0.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.0/repmgr/EL-6/repmgrd.sysconfig b/rpm/redhat/9.0/repmgr/EL-6/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.0/repmgr/EL-6/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.1/repmgr/EL-5/repmgr.init b/rpm/redhat/9.1/repmgr/EL-5/repmgr.init index c7c16ac..3e72255 100644 --- a/rpm/redhat/9.1/repmgr/EL-5/repmgr.init +++ b/rpm/redhat/9.1/repmgr/EL-5/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.1.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.1/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.1.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.1/repmgr/EL-5/repmgrd.sysconfig b/rpm/redhat/9.1/repmgr/EL-5/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.1/repmgr/EL-5/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.1/repmgr/EL-6/repmgr.init b/rpm/redhat/9.1/repmgr/EL-6/repmgr.init index c7c16ac..3e72255 100644 --- a/rpm/redhat/9.1/repmgr/EL-6/repmgr.init +++ b/rpm/redhat/9.1/repmgr/EL-6/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.1.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.1/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.1.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.1/repmgr/EL-6/repmgrd.sysconfig b/rpm/redhat/9.1/repmgr/EL-6/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.1/repmgr/EL-6/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.2/repmgr/EL-5/repmgr.init b/rpm/redhat/9.2/repmgr/EL-5/repmgr.init index 91a89ef..7a8463e 100644 --- a/rpm/redhat/9.2/repmgr/EL-5/repmgr.init +++ b/rpm/redhat/9.2/repmgr/EL-5/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.2.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.2/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.2.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.2/repmgr/EL-5/repmgrd.sysconfig b/rpm/redhat/9.2/repmgr/EL-5/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.2/repmgr/EL-5/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.2/repmgr/EL-6/repmgr.init b/rpm/redhat/9.2/repmgr/EL-6/repmgr.init index 91a89ef..7a8463e 100644 --- a/rpm/redhat/9.2/repmgr/EL-6/repmgr.init +++ b/rpm/redhat/9.2/repmgr/EL-6/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.2.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.2/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.2.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.2/repmgr/EL-6/repmgrd.sysconfig b/rpm/redhat/9.2/repmgr/EL-6/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.2/repmgr/EL-6/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.2/repmgr/EL-7/repmgr.init b/rpm/redhat/9.2/repmgr/EL-7/repmgr.init index 91a89ef..7a8463e 100644 --- a/rpm/redhat/9.2/repmgr/EL-7/repmgr.init +++ b/rpm/redhat/9.2/repmgr/EL-7/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.2.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.2/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.2.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.2/repmgr/EL-7/repmgrd.sysconfig b/rpm/redhat/9.2/repmgr/EL-7/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.2/repmgr/EL-7/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.2/repmgr/F-19/repmgr.init b/rpm/redhat/9.2/repmgr/F-19/repmgr.init index 91a89ef..7a8463e 100644 --- a/rpm/redhat/9.2/repmgr/F-19/repmgr.init +++ b/rpm/redhat/9.2/repmgr/F-19/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.2.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.2/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.2.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.2/repmgr/F-19/repmgrd.sysconfig b/rpm/redhat/9.2/repmgr/F-19/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.2/repmgr/F-19/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/EL-5/repmgr.init b/rpm/redhat/9.3/repmgr/EL-5/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/EL-5/repmgr.init +++ b/rpm/redhat/9.3/repmgr/EL-5/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/EL-5/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/EL-5/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/EL-5/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/EL-6/repmgr.init b/rpm/redhat/9.3/repmgr/EL-6/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/EL-6/repmgr.init +++ b/rpm/redhat/9.3/repmgr/EL-6/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/EL-6/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/EL-6/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/EL-6/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/EL-7/repmgr.init b/rpm/redhat/9.3/repmgr/EL-7/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/EL-7/repmgr.init +++ b/rpm/redhat/9.3/repmgr/EL-7/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/EL-7/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/EL-7/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/EL-7/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/F-19/repmgr.init b/rpm/redhat/9.3/repmgr/F-19/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/F-19/repmgr.init +++ b/rpm/redhat/9.3/repmgr/F-19/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/F-19/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/F-19/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/F-19/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/F-20/repmgr.init b/rpm/redhat/9.3/repmgr/F-20/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/F-20/repmgr.init +++ b/rpm/redhat/9.3/repmgr/F-20/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/F-20/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/F-20/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/F-20/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/F-21/repmgr.init b/rpm/redhat/9.3/repmgr/F-21/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/F-21/repmgr.init +++ b/rpm/redhat/9.3/repmgr/F-21/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/F-21/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/F-21/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/F-21/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/F-22/repmgr.init b/rpm/redhat/9.3/repmgr/F-22/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/F-22/repmgr.init +++ b/rpm/redhat/9.3/repmgr/F-22/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/F-22/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/F-22/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/F-22/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.3/repmgr/F-23/repmgr.init b/rpm/redhat/9.3/repmgr/F-23/repmgr.init index e7b2237..3f9bf49 100644 --- a/rpm/redhat/9.3/repmgr/F-23/repmgr.init +++ b/rpm/redhat/9.3/repmgr/F-23/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.3.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.3/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.3.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.3/repmgr/F-23/repmgrd.sysconfig b/rpm/redhat/9.3/repmgr/F-23/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.3/repmgr/F-23/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.4/repmgr/EL-5/repmgr.init b/rpm/redhat/9.4/repmgr/EL-5/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/EL-5/repmgr.init +++ b/rpm/redhat/9.4/repmgr/EL-5/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.4/repmgr/EL-6/repmgr.init b/rpm/redhat/9.4/repmgr/EL-6/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/EL-6/repmgr.init +++ b/rpm/redhat/9.4/repmgr/EL-6/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.4/repmgr/EL-6/repmgrd.sysconfig b/rpm/redhat/9.4/repmgr/EL-6/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.4/repmgr/EL-6/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.4/repmgr/EL-7/repmgr.init b/rpm/redhat/9.4/repmgr/EL-7/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/EL-7/repmgr.init +++ b/rpm/redhat/9.4/repmgr/EL-7/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.4/repmgr/F-20/repmgr.init b/rpm/redhat/9.4/repmgr/F-20/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/F-20/repmgr.init +++ b/rpm/redhat/9.4/repmgr/F-20/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.4/repmgr/F-21/repmgr.init b/rpm/redhat/9.4/repmgr/F-21/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/F-21/repmgr.init +++ b/rpm/redhat/9.4/repmgr/F-21/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.4/repmgr/F-22/repmgr.init b/rpm/redhat/9.4/repmgr/F-22/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/F-22/repmgr.init +++ b/rpm/redhat/9.4/repmgr/F-22/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.4/repmgr/F-23/repmgr.init b/rpm/redhat/9.4/repmgr/F-23/repmgr.init index c900170..fd0fdd2 100644 --- a/rpm/redhat/9.4/repmgr/F-23/repmgr.init +++ b/rpm/redhat/9.4/repmgr/F-23/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.4.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.4/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.4.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l repmgr -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/EL-5/repmgr.init b/rpm/redhat/9.5/repmgr/EL-5/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/EL-5/repmgr.init +++ b/rpm/redhat/9.5/repmgr/EL-5/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/EL-5/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/EL-5/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/EL-5/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.5/repmgr/EL-6/repmgr.init b/rpm/redhat/9.5/repmgr/EL-6/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/EL-6/repmgr.init +++ b/rpm/redhat/9.5/repmgr/EL-6/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/EL-6/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/EL-6/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/EL-6/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.5/repmgr/EL-7/repmgr.init b/rpm/redhat/9.5/repmgr/EL-7/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/EL-7/repmgr.init +++ b/rpm/redhat/9.5/repmgr/EL-7/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/EL-7/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/EL-7/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/EL-7/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.5/repmgr/F-20/repmgr.init b/rpm/redhat/9.5/repmgr/F-20/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/F-20/repmgr.init +++ b/rpm/redhat/9.5/repmgr/F-20/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/F-20/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/F-20/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/F-20/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.5/repmgr/F-21/repmgr.init b/rpm/redhat/9.5/repmgr/F-21/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/F-21/repmgr.init +++ b/rpm/redhat/9.5/repmgr/F-21/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/F-21/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/F-21/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/F-21/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.5/repmgr/F-22/repmgr.init b/rpm/redhat/9.5/repmgr/F-22/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/F-22/repmgr.init +++ b/rpm/redhat/9.5/repmgr/F-22/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/F-22/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/F-22/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/F-22/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log diff --git a/rpm/redhat/9.5/repmgr/F-23/repmgr.init b/rpm/redhat/9.5/repmgr/F-23/repmgr.init index b52ce41..f9b402d 100644 --- a/rpm/redhat/9.5/repmgr/F-23/repmgr.init +++ b/rpm/redhat/9.5/repmgr/F-23/repmgr.init @@ -29,32 +29,63 @@ user=repmgr prog=repmgrd pidfile=/var/run/repmgr/repmgrd-9.5.pid lockfile=/var/lock/subsys/$prog +REPMGRD_ENABLED=no +REPMGRD_OPTS= REPMGRDCONF=/etc/repmgr/9.5/repmgr.conf REPMGRDLOG=/var/log/repmgr/repmgrd-9.5.log # Get config. . /etc/sysconfig/network +# Read configuration variable file if it is present +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +test -x $exec || exit 0 + +case "$REPMGRD_ENABLED" in + [Yy]*) + break + ;; + *) + exit 0 + ;; +esac + +if [ -z "${REPMGRD_OPTS}" ] +then + echo "Not starting ${prog}, REPMGRD_OPTS not set in /etc/sysconfig/${prog}" + exit 0 +fi + # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 6 start(){ [ -x $exec ] || exit 5 - [ -f "$REPMGRDCONF" ] || exit 6 + [ -f "${REPMGRDCONF}" ] || exit 6 echo -n "Starting $prog: " # Make sure startup-time log file is valid - if [ ! -e "$REPMGRDLOG" -a ! -h "$REPMGRDLOG" ] + if [ ! -e "${REPMGRDLOG}" -a ! -h "${REPMGRDLOG}" ] then - touch "$REPMGRDLOG" || exit 1 - chown $user: "$REPMGRDLOG" - chmod go-rwx "$REPMGRDLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$REPMGRDLOG" 2>/dev/null + touch "${REPMGRDLOG}" || exit 1 + chown $user: "${REPMGRDLOG}" + chmod go-rwx "${REPMGRDLOG}" + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "${REPMGRDLOG}" 2>/dev/null fi mkdir -p $(dirname $pidfile) chown $user: $(dirname $pidfile) - su -l $user -c "$exec -f $REPMGRDCONF -p $pidfile -d ->> $REPMGRDLOG 2>&1" $user # --monitoring-history --verbose + ${SU} -l -c "${exec} -f ${REPMGR_CONF} ${REPMGRD_OPTS} -p ${pidfile} >> ${REPMGRDLOG} 2>&1" ${user} < /dev/null + sleep 2 retval=$? [ $retval -eq 0 ] && success echo diff --git a/rpm/redhat/9.5/repmgr/F-23/repmgrd.sysconfig b/rpm/redhat/9.5/repmgr/F-23/repmgrd.sysconfig new file mode 100644 index 0000000..e9c5aa9 --- /dev/null +++ b/rpm/redhat/9.5/repmgr/F-23/repmgrd.sysconfig @@ -0,0 +1,24 @@ +# default settings for repmgrd. This file is source by /bin/sh from +# /etc/init.d/repmgrd + +# disable repmgrd by default so it won't get started upon installation +# valid values: yes/no +REPMGRD_ENABLED=no + +# Repmgr conf file +REPMGR_CONF=/var/lib/pgsql/repmgr/repmgr.conf + +# Options for repmgrd (required) +#REPMGRD_OPTS="--verbose -d " + +# User to run repmgrd as +#REPMGRD_USER=postgres + +# repmgrd binary +#REPMGRD_BIN=/usr/bin/repmgrd + +# pid file +#REPMGRD_PIDFILE=/var/lib/pgsql/repmgr/repmgrd.pid + +# log file +#REPMGRD_LOG=/var/lib/pgsql/repmgr/repmgrd.log -- 2.5.0 --------------080703020603090509050909 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-pkg-yum mailing list (pgsql-pkg-yum@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-pkg-yum --------------080703020603090509050909--