postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid

From: Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid
Date: 2019-05-14 09:19:42
Message-ID: CA+t6e1n2R7XR_Ykwjt=K1Cn+=tY7FF6j+zFZiAHFYSgJ9AaVRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hey,
I'm using a machine in aws and when the machine starts all the services are
starting including postgresql(v9.6 , centos). However, when I check the
service`s status I see that it is stopped but all the processes are up (ps
-ef ) and the postmaster.pid file is exist with the pid of the postmaster.

The next part of code responsible for starting postgresql in
redhat(/etc/init.d/postgresql) :
$SU -l postgres -c "$PGENGINE/postmaster -D '$PGDATA' ${PGOPTS}
>>\"$PGLOG\" 2>&1 &"
sleep 2
pid=`head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null`
if [ "x$pid" != x ]
then
success "$PSQL_START"
touch "$lockfile"
echo $pid > "$pidfile"
echo
else
failure "$PSQL_START"
echo
script_result=1
fi

It seems that the sleep 2 isnt enough time to start the processes and thats
why the service shows that the instance is down while it is up. Does any
one faced this type of issue ? I mean, I can increase the sleep , but I
dont think that it is the perfect solution in this case.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2019-05-14 11:29:25 Re: postgresql service started but pid is not saved in /var/run/postgresql/postgresql.pid
Previous Message pavan95 2019-05-13 11:23:44 Re: Installation of login_hook in PostgreSQL 10