run function on server restart
Sometimes the server process crashes and restarts, usually when I run some
large calculations that eat up all available memory. Is there any way to
detect this and run a cleanup routine when it happens? Running 8.4 on
Ubuntu.
-- John
"John D. West" <john.d.west@asu.edu> wrote:
Sometimes the server process crashes and restarts, usually when I
run some large calculations that eat up all available memory.
You might want to reconfigure to avoid that.
Is there any way to detect this and run a cleanup routine when it
happens?
What is it that are you trying to clean up?
-Kevin
I have various background processes outside of postgres that need to be
killed and restarted after the server reboots.
-- John
On Fri, Aug 24, 2012 at 2:29 PM, Kevin Grittner <Kevin.Grittner@wicourts.gov
Show quoted text
wrote:
"John D. West" <john.d.west@asu.edu> wrote:
Sometimes the server process crashes and restarts, usually when I
run some large calculations that eat up all available memory.You might want to reconfigure to avoid that.
Is there any way to detect this and run a cleanup routine when it
happens?What is it that are you trying to clean up?
-Kevin
On 08/24/2012 03:46 PM, John D. West wrote:
I have various background processes outside of postgres that need to be
killed and restarted after the server reboots.-- John
On Fri, Aug 24, 2012 at 2:29 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov <mailto:Kevin.Grittner@wicourts.gov>> wrote:"John D. West" <john.d.west@asu.edu <mailto:john.d.west@asu.edu>> wrote:
Sometimes the server process crashes and restarts, usually when I
run some large calculations that eat up all available memory.You might want to reconfigure to avoid that.
Is there any way to detect this and run a cleanup routine when it
happens?What is it that are you trying to clean up?
-Kevin
Seems it would be the responsibility of the dependent processes to
recognize pg went away, and clean themselves up (as only they know how
to do).
"John D. West" <john.d.west@asu.edu> wrote:
I have various background processes outside of postgres that need
to be killed and restarted after the server reboots.
All of our applications are coded such that when they have an error
on a database connection, they check for a serialization failure or
a broken connection; if they find either they retry the database
transaction. That would be my first recommendation. (Well, second,
after identifying the causes of server crashes and fixing them.)
Are you running any monitoring applications which could trigger what
you want?
-Kevin
I *think* my independent processes are cleaning up in that they supposedly
abort themselves if they lose db connection, but on restart there is a
table of pid's I'd like to (1) make sure all of the processes are really
dead, killing any who aren't (2) reset flags in a table showing the status
of those process, and (3) clear out the pid list so I can restart the
processes.
Apparently the answer to my original question is "no, there is no way to
run a function at postgres startup." The question on monitoring apps
intrigues me, however. What can they do, and what is available?
Thanks!
-- John
On Fri, Aug 24, 2012 at 3:56 PM, Kevin Grittner <Kevin.Grittner@wicourts.gov
Show quoted text
wrote:
"John D. West" <john.d.west@asu.edu> wrote:
I have various background processes outside of postgres that need
to be killed and restarted after the server reboots.All of our applications are coded such that when they have an error
on a database connection, they check for a serialization failure or
a broken connection; if they find either they retry the database
transaction. That would be my first recommendation. (Well, second,
after identifying the causes of server crashes and fixing them.)Are you running any monitoring applications which could trigger what
you want?-Kevin
On Sat, Aug 25, 2012 at 8:25 AM, John D. West <john.d.west@asu.edu> wrote:
I *think* my independent processes are cleaning up in that they supposedly
abort themselves if they lose db connection, but on restart there is a table
of pid's I'd like to (1) make sure all of the processes are really dead,
killing any who aren't (2) reset flags in a table showing the status of
those process, and (3) clear out the pid list so I can restart the
processes.
Hmm. I wonder is there a way to not use a table for this. What's the
status flagging intended to do? Can it be accomplished with, perhaps,
locks?
ChrisA
It's become clear I need to go back and rethink my logic for this
functionality. Thanks for all of the suggestions.
-- John
On Sat, Aug 25, 2012 at 12:40 AM, Chris Angelico <rosuav@gmail.com> wrote:
Show quoted text
On Sat, Aug 25, 2012 at 8:25 AM, John D. West <john.d.west@asu.edu> wrote:
I *think* my independent processes are cleaning up in that they
supposedly
abort themselves if they lose db connection, but on restart there is a
table
of pid's I'd like to (1) make sure all of the processes are really dead,
killing any who aren't (2) reset flags in a table showing the status of
those process, and (3) clear out the pid list so I can restart the
processes.Hmm. I wonder is there a way to not use a table for this. What's the
status flagging intended to do? Can it be accomplished with, perhaps,
locks?ChrisA
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general