Re: RHEL 7 (systemd) reboot - Mailing list pgsql-general
From | Adrian Klaver |
---|---|
Subject | Re: RHEL 7 (systemd) reboot |
Date | |
Msg-id | 711aa192-9733-8a4c-90a1-46b40876fad9@aklaver.com Whole thread Raw |
In response to | RE: RHEL 7 (systemd) reboot (Bryce Pepper <BPepper@KCSouthern.com>) |
Responses |
RE: RHEL 7 (systemd) reboot
|
List | 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. Thectmdist 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 updatequery. > > 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@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@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.klaver@aklaver.com
pgsql-general by date: