Re: [GENERAL] run function on server restart

2012-08-26 Thread John D. West
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 ros...@gmail.com wrote:

 On Sat, Aug 25, 2012 at 8:25 AM, John D. West john.d.w...@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



Re: [GENERAL] run function on server restart

2012-08-25 Thread Chris Angelico
On Sat, Aug 25, 2012 at 8:25 AM, John D. West john.d.w...@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


Re: [GENERAL] run function on server restart

2012-08-24 Thread Kevin Grittner
John D. West john.d.w...@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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] run function on server restart

2012-08-24 Thread John D. West
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.gritt...@wicourts.gov
 wrote:

 John D. West john.d.w...@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



Re: [GENERAL] run function on server restart

2012-08-24 Thread Rob Sargent

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.gritt...@wicourts.gov mailto:kevin.gritt...@wicourts.gov wrote:

John D. West john.d.w...@asu.edu mailto:john.d.w...@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).





--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] run function on server restart

2012-08-24 Thread Kevin Grittner
John D. West john.d.w...@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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] run function on server restart

2012-08-24 Thread John D. West
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.gritt...@wicourts.gov
 wrote:

 John D. West john.d.w...@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