Postgres for Jasper is not shutting down cleanly or quickly
search cancel

Postgres for Jasper is not shutting down cleanly or quickly

book

Article ID: 130249

calendar_today

Updated On: 10-04-2023

Products

Spectrum

Issue/Introduction

Postgres does not shutdown cleanly or quickly.
Message indicates:

pg_ctl: server does not shut down

 

Environment

Release:
Component: SPCCSS

Cause

The script times out waiting for the server to actually shutdown.

Resolution

This section of the stopservers.sh script: 
 

This section of the stopservers.sh script:

# This method starts postgres
function stopPostgres
{
echo "Default Postgres database user is: "$postgreSqlUser
echo "Default Postgres database port is: "$postgresPort
checkPortRunning $postgresPort
portReturn=$?

if [ "$portReturn" -eq "0" ]
then
return 2
else
su $postgreSqlUser -c "postgresql/bin/pg_ctl -D postgresql/data -l postgresql/logs/log.txt stop"
waitForPortToClose "$postgresPort" 180
#echo "Postgres"$?
pportreturn=$?
#echo "Got "$pportreturn" from wait"
if [ "$pportreturn" -eq "1" ]
then
return 0
else
return 1
fi
fi

}






Change this line: 
 

"su $postgreSqlUser -c "postgresql/bin/pg_ctl -D postgresql/data -l postgresql/logs/log.txt stop"



To: 
 

"su $postgreSqlUser -c "postgresql/bin/pg_ctl -D postgresql/data -l postgresql/logs/log.txt stop -m fast"


The script should now shutdown quicker and successfully.