pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Pepper <BPepper@KCSouthern.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: RE: RHEL 7 (systemd) reboot
Date: Thu, 11 Oct 2018 13:33:03 +0000
Message-ID: <21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP> (raw)
In-Reply-To: <711aa192-9733-8a4c-90a1-46b40876fad9@aklaver.com>
References: <49f8b4546d9948d798d81e1fd32bfb4f@WNEXMBFEP03.KCSCP.CORP>
	<532b0c39-6b76-658f-fe45-852dd964d7ba@aklaver.com>
	<5de197dc0e9241c59caad6cb3f69ef25@WNEXMBFEP03.KCSCP.CORP>
	<5c30d3c8-ddd0-452c-a667-cb1356c10c47@aklaver.com>
	<b8db64244cf74bcc989502fb46e8ac97@WNEXMBFEP03.KCSCP.CORP>
	<711aa192-9733-8a4c-90a1-46b40876fad9@aklaver.com>

Adrian,

Thanks for being willing to dig into this.  

You are correct there are other scripts being called from mine (delivered by BMC with their software).   In order to stay in support and work with their updates I use the vendor supplied scripts/programs.  

The Control-M product is installed on this single server and is broken down into the following parts:
Enterprise server with dedicated postgresql instance
Distributed datacenter with agent and dedicated postgresql instance
Linux datacenter with with agent and dedicated postgresql instance

To cut down on the noise, my post only focused on the "Distributed" side and shutdown process -- although the ControlM_Shutdown.service unit stop script manages all of the above components.

In the ControlM_Shutdown.service there is a requires statement identifying that  network must be available while this systemd unit runs.

You noticed that the eth0 disconnected in the /var/log/messages.   I showed that to highlight that the unit was not executing in the order I had intended, again refer to the requires statement.

The second shebang is from one of the invoked subscripts (stop_ctmdist_server.sh) and is the "main" shutdown sequence for the Distributed datacenter (I think the "SQL server" echo from BMC is because it can be configured with other databases and they use it in a generic term --- not meaning sqlserver from Microsoft).

The dbversion check is being used to verify pgsql instance for this datacenter is running and returns a non-zero return code if the instance is unreachable (I could use pg_isready or pg_ctl but would diverge further from the BMC supported technique).

You probably also noticed in the earlier posted shutdown service a requires of CTM_Postgre.service.  This was one of my attempts to ensure the instance was available by actually starting the instance outside of the BMC routines (if it is already running the BMC routines will not start -- the dbversion check is on the start side also).  I thought if I managed the postgresql instance outside of the product I could ensure it was running.  Unfortunately that didn't work as the instance shutdown on its own, presumably a resource (perhaps network) was terminated and postgresql shutdown.  

So to restate the original post...   It appears the postgresql instance is unavailable when the stop script runs.  

Thanks,
Bryce

[root@kccontrolmt01 ~]# systemctl --full cat ControlM_Shutdown.service
# /etc/systemd/system/ControlM_Shutdown.service
[Unit]
Description=Run ControlM shutdown process
Requires=graphical.target multi-user.target network.target network.service sockets.target
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target poweroff.target kexec.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/bin/bash /root/scripts/control-m_shutdown.sh
TimeoutStopSec=4min

[Install]
WantedBy=multi-user.target
[root@kccontrolmt01 ~]#



view thread (13+ messages)  latest in thread

Message-ID: <21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP>
Permalink:  ../21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP/
Also on:    postgresql.org/message-id/21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: BPepper@KCSouthern.com, adrian.klaver@aklaver.com
  Subject: Re: RHEL 7 (systemd) reboot
  In-Reply-To: <21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP>
  References: <49f8b4546d9948d798d81e1fd32bfb4f@WNEXMBFEP03.KCSCP.CORP> <532b0c39-6b76-658f-fe45-852dd964d7ba@aklaver.com> <5de197dc0e9241c59caad6cb3f69ef25@WNEXMBFEP03.KCSCP.CORP> <5c30d3c8-ddd0-452c-a667-cb1356c10c47@aklaver.com> <b8db64244cf74bcc989502fb46e8ac97@WNEXMBFEP03.KCSCP.CORP> <711aa192-9733-8a4c-90a1-46b40876fad9@aklaver.com> <21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox