Thread: Yum install fails to stop PostgreSQL on complete removal

Yum install fails to stop PostgreSQL on complete removal

From
Craig Ringer
Date:
Hi

It looks like the PGDG RPMs for PostgreSQL don't stop the server in the
prerm script even when the package is being fully uninstalled, not just
replaced.

I'd like to add a prerm script that tests the prerm script argument to
see whether it's 0 (package being uninstalled) and if so, stops
PostgreSQL. Objections? This will *not* stop or restart PostgreSQL when
the package is just updated.

Separately, I'd like to _restart_ PostgreSQL in a %post script if it's
already running and we updated the package. PostgreSQL shouldn't really
be running w/o a restart after a minor version update.

Comments?

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


Re: Yum install fails to stop PostgreSQL on complete removal

From
Devrim Gündüz
Date:
Hi,

On Wed, 2014-06-18 at 12:37 +0800, Craig Ringer wrote:

> It looks like the PGDG RPMs for PostgreSQL don't stop the server in
> the prerm script even when the package is being fully uninstalled, not
> just replaced.

I think we do?

%preun server
if [ $1 = 0 ] ; then
        /sbin/service postgresql-%{majorversion} condstop >/dev/null 2>&1
        chkconfig --del postgresql-%{majorversion}
fi


> Separately, I'd like to _restart_ PostgreSQL in a %post script if it's
> already running and we updated the package. PostgreSQL shouldn't
> really be running w/o a restart after a minor version update.

We do restart it.

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR


Attachment

Re: Yum install fails to stop PostgreSQL on complete removal

From
Craig Ringer
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/18/2014 10:04 PM, Devrim Gündüz wrote:
>
> Hi,
>
> On Wed, 2014-06-18 at 12:37 +0800, Craig Ringer wrote:
>
>> It looks like the PGDG RPMs for PostgreSQL don't stop the server
>> in the prerm script even when the package is being fully
>> uninstalled, not just replaced.
>
> I think we do?
>
> %preun server if [ $1 = 0 ] ; then /sbin/service
> postgresql-%{majorversion} condstop >/dev/null 2>&1 chkconfig --del
> postgresql-%{majorversion} fi
>
>
>> Separately, I'd like to _restart_ PostgreSQL in a %post script if
>> it's already running and we updated the package. PostgreSQL
>> shouldn't really be running w/o a restart after a minor version
>> update.
>
> We do restart it.

So I see. Bizarre. Neither seems to be taking effect here.

I'll debug locally.

- --
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJToZ7PAAoJELBXNkqjr+S2YIgH/38lTWxTiYlVNdTsR/xPR9Cy
e1Y9c3NZHpo9zX94Nsx1AbD1qmJgMj5VpQ6ppa+3T9pW/R9bnsNWhREyCzQci1qz
uA163Y5NDK+hIBHOf+UWHtD85JLYt7cfrmzgdNJ3c2VWWnkP6VbMmdGsYCfIYRIk
cpOL3I4ITJDAwip3SyGvQPETTTpd77Q1aecp9xUUtGh2jx/bU9Eu7wy/cmuRKor8
eNFVEJDfBjcUwRxgUSlQ6nPwbZ+drFKwu1gsu58GA79/xpVeh7VyB8LzbCTkY3z+
KH7p9iQqDWRYMLrAyWLzh0DEJh/MrDFAwcyBa2bJAfWyLnCnjv3LAsFuTf6h7H0=
=o5bt
-----END PGP SIGNATURE-----


Re: Yum install fails to stop PostgreSQL on complete removal

From
Devrim Gündüz
Date:
Hi,

On Wed, 2014-06-18 at 22:14 +0800, Craig Ringer wrote:
> I'll debug locally.

Let me know if you need help. I just tested this on a fresh CentOS 6 vm,
and it worked.

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR


Attachment