From: | Bryce Pepper <BPepper(at)KCSouthern(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | RE: RHEL 7 (systemd) reboot |
Date: | 2018-10-11 13:33:03 |
Message-ID: | 21090661bc8a446680cb108fac2486f9@WNEXMBFEP03.KCSCP.CORP |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)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(at)kccontrolmt01 ~]#
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2018-10-11 14:05:36 | Re: RHEL 7 (systemd) reboot |
Previous Message | Mike Martin | 2018-10-11 11:06:56 | Re: Advice on logging strategy |