Re: Shell script Postgres Running

From: Keith <keith(at)keithf4(dot)com>
To: Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Shell script Postgres Running
Date: 2016-05-19 02:37:50
Message-ID: CAHw75vu5HoBH3-QS7L0XN6ZCN=EMEoZ5Sg6c6QyN1esR8Fd1VQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, May 18, 2016 at 7:52 PM, Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
wrote:

> Hi all,
>
> I'm writing a shell script to get the information if postgres is or is not
> running.
>
> #!/usr/bin/ksh
>> # the path to the PID file
>> PIDFILE=/var/lib/pgsql/9.2/data/postmaster.pid
>> if [ -f $PIDFILE ] ; then
>> PID=`cat $PIDFILE`
>> if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
>> STATUS="There is a pidfile, YES, Postgres is running."
>> else
>> STATUS="There is no pidfile, Postgres is not running."
>> fi
>> else
>> STATUS="There is no pidfile, Postgres is not running."
>> fi
>> echo $STATUS
>
>
> The script above works.. But, is there any way to get the same
> information, but with the checkpoints?
>
> When you have a huge shared_buffer, when stopping the postgres' process,
> it will take some time to get it running again, right? Because the server
> will be writing a checkpoint?
>
> So I'd like to check that... Is it possible?
>
> Cheers
> Lucas
>
>
Try using the pg_isready binary that comes with postgres to see if it's up
and accepting connections

http://www.postgresql.org/docs/current/static/app-pg-isready.html

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Lucas Possamai 2016-05-19 02:43:38 Re: Shell script Postgres Running
Previous Message Lucas Possamai 2016-05-18 23:52:46 Shell script Postgres Running