Lists: | pgsql-general |
---|
From: | "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | hard shutdown of system |
Date: | 2006-04-17 06:47:21 |
Message-ID: | 8626C1B7EB748940BCDD7596134632BE398673@jal.iiitb.ac.in |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
the user tries to do kill -9 -1 and log in again
in the startup script i do the following
/sbin/pidof -s postmaster
and it still displays some value,
however ps -aef | grep postmaster does not display anything
is it ok if i do the following
pid1=`/sbin/pidof -s postmaster`
pid2=`ps -eaf | grep postmaster | grep -v grep | tail -1 | awk '{print $2}'`
if ($pid1 and $pid2)
=> postmaster is already running
otherwise
i check if postmaster.pid exists
if it does, i delete it
and then start postmaster by doing $PGCTL -l $POSTGRES_LOG -D $PGDATA -p $POSTMASTER -o '-p ${PGPORT}' start > /dev/null 2>&1
is it ok?
thanks,
regards
Surabhi
From: | "chris smith" <dmagick(at)gmail(dot)com> |
---|---|
To: | "surabhi(dot) ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: hard shutdown of system |
Date: | 2006-04-17 07:44:39 |
Message-ID: | 3c1395330604170044x1a191bf6m3fe81a4ae2507b7e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 4/17/06, surabhi.ahuja <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> wrote:
>
> the user tries to do kill -9 -1 and log in again
>
> in the startup script i do the following
>
> /sbin/pidof -s postmaster
>
> and it still displays some value,
>
> however ps -aef | grep postmaster does not display anything
>
> is it ok if i do the following
> pid1=`/sbin/pidof -s postmaster`
> pid2=`ps -eaf | grep postmaster | grep -v grep | tail -1 | awk '{print
> $2}'`
>
> if ($pid1 and $pid2)
> => postmaster is already running
>
> otherwise
>
> i check if postmaster.pid exists
> if it does, i delete it
> and then start postmaster by doing $PGCTL -l $POSTGRES_LOG -D $PGDATA -p
> $POSTMASTER -o '-p ${PGPORT}' start > /dev/null 2>&1
Check out the startup script. Depending on what system you are
running, this might already all be taken care of.
Here's a mandrake example (I think the redhat version is pretty similar).
http://techdocs.postgresql.org/scripts/mandrake72-startup
--
Postgresql & php tutorials
http://www.designmagick.com/
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: hard shutdown of system |
Date: | 2006-04-17 14:18:51 |
Message-ID: | 542.1145283531@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
"surabhi.ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> writes:
> the user tries to do kill -9 -1 and log in again
The *first* thing you gotta do is retrain your user. kill -9
is never the appropriate way to shut down the postmaster.
The script mods you describe seem to be oriented at forcing the
postmaster to restart when there are still live child processes
of the old postmaster. That is a REALLY BAD IDEA. It will lead
to unrecoverable corruption of your database. The safety checks
that are in the postmaster are there to keep you from destroying
your database --- overriding them by removing the pid file is
not safe, recommended, or supported.
The last question is why your user wants to shut down the postmaster
so often? There shouldn't be any need for that in ordinary scenarios.
regards, tom lane