From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Bryce Pepper <BPepper(at)KCSouthern(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-10 19:10:23 |
Message-ID: | 711aa192-9733-8a4c-90a1-46b40876fad9@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10/10/18 7:37 AM, Bryce Pepper wrote:
> Sorry, I wasn't clear in the prior posts.
>
> The stop script is running during reboot. The problem is the database is not reachable when the stop script runs. The ctmdist server shut down is as follows:
> Stop control-m application
> Stop control-m configuration agent
> Stop database
Several things:
1) In your OP there was this:
Oct 05 14:18:56 kccontrolmt01 network[29310]: Shutting down interface
eth0: Device 'eth0' successfully disconnected.
Oct 05 14:18:56 kccontrolmt01 network[29310]: [ OK ]
Oct 05 14:18:56 kccontrolmt01 stop_ctmlinux_server.sh[29185]:
------------------------
Oct 05 14:18:56 kccontrolmt01 stop_ctmlinux_server.sh[29185]: Shutting
down CONTROL-M.
So is your Postgres instance running on the same machine as the CTM
instance or does the eth0 need to be up to reach the database?
2) In the above there is:
"Shutting down CONTROL-M."
Yet in script below there is:
"Stopping CONTROL-M application"
Is this because there are sub-scripts involved or the "Stopping ..." is
embedded in the script?
3) I am by no means a shell script expert and I will admit to not fully
understanding what control-m_shutdown.sh does. Still here it goes:
a) Are there actually two shebangs in one file or are there two files
involved?
b) What is:
# stop database
/data00/ctmlinux/ctm_server/scripts/dbversion
if [ $? -ne 0 ] ; then
echo "SQL Server is already stopped "
else
if [ -f /data00/ctmlinux/ctm_server/scripts/shutdb ]; then
echo "Stopping SQL server for CONTROL-M"
/data00/ctmlinux/ctm_server/scripts/shutdb
fi
actually doing?
I ask because from what I can see there are a set of parallel processes
initiated and it is possible that the database server is winning. It
comes down to what 'if [ $? -ne 0 ]' is testing.
>
> As you can see the intent is for the database to be shut down after the product.
>
> But as you noticed from /var/log/message the stop_ctmlinux_server.sh script is running but unable to execute the update query.
>
> I created the following Service definition and scripts that follow -- note there are 2 datacenters (ctmdist, ctmlinux) that have comparable scripts so I have only included one set:
>
> [root(at)kccontrolmt01 ~]# cat ControlM_Shutdown.service
> [Unit]
> Description=Run mycommand at shutdown
> Requires=network.target CTM_Postgre.service
> DefaultDependencies=no
> Before=shutdown.target reboot.target
>
> [Service]
> Type=oneshot
> RemainAfterExit=true
> ExecStart=/bin/true
> ExecStop=/root/scripts/control-m_shutdown.sh
>
> [Install]
> WantedBy=multi-user.target
>
>
> [root(at)kccontrolmt01 ~]# cat /root/scripts/control-m_shutdown.sh
> #!/bin/sh
> # Shutdown any running Control-M services
> STATUS=$(/usr/bin/systemctl is-active CTMLinux_Server.service)
> if [ ${STATUS} == "active" ]; then
> /usr/bin/systemctl stop CTMLinux_Server.service
> fi
>
> STATUS=$(/usr/bin/systemctl is-active CTMDist_Server.service)
> if [ ${STATUS} == "active" ]; then
> /usr/bin/systemctl stop CTMDist_Server.service
> fi
>
> STATUS=$(/usr/bin/systemctl is-active EnterpriseManager.service)
> if [ ${STATUS} == "active" ]; then
> /usr/bin/systemctl stop EnterpriseManager.service
> fi
> exit 0
>
>
> #!/bin/bash
>
> # stop CONTROL-M
> if [ -f /data00/ctmlinux/ctm_server/scripts/shut_ctm ]; then
> echo "Stopping CONTROL-M application"
> /data00/ctmlinux/ctm_server/scripts/shut_ctm
> fi
>
> # stop CONTROL-M Configuration Agent
> if [ -f /data00/ctmlinux/ctm_server/scripts/shut_ca ]; then
> echo "Stopping CONTROL-M Server Configuration Agent"
> /data00/ctmlinux/ctm_server/scripts/shut_ca
> fi
>
> # stop database
> /data00/ctmlinux/ctm_server/scripts/dbversion
> if [ $? -ne 0 ] ; then
> echo "SQL Server is already stopped "
> else
> if [ -f /data00/ctmlinux/ctm_server/scripts/shutdb ]; then
> echo "Stopping SQL server for CONTROL-M"
> /data00/ctmlinux/ctm_server/scripts/shutdb
> fi
> fi
>
> exit 0
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Aleš Zelený | 2018-10-10 19:20:31 | Re: tds_fdw binary column |
Previous Message | Rob Sargent | 2018-10-10 17:14:47 | Re: COPY threads |