Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-08 Thread Melvin Davidson
On Sun, Oct 8, 2017 at 10:01 AM, athinivas wrote: > Yes, will take the epoch value from same and create a new file. Upon > subsequent calls, will access with that filename...if it fails(incase if > the > postmaster is restarted), will create a new one. > > @Melvin Does this

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-08 Thread athinivas
Yes, will take the epoch value from same and create a new file. Upon subsequent calls, will access with that filename...if it fails(incase if the postmaster is restarted), will create a new one. @Melvin Does this capture all failure scenarios?? Or you have any other better ways to do it. Your

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-08 Thread Melvin Davidson
On Sun, Oct 8, 2017 at 8:33 AM, athinivas wrote: > Hi, > > Thank you...will try it :) ...As of now, I'm creating the filename as > pg_start_time so that, every time the server is up, a new file will be > created. > > > Regards, > Athi > > > > -- > Sent from:

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-08 Thread athinivas
Hi, Thank you...will try it :) ...As of now, I'm creating the filename as pg_start_time so that, every time the server is up, a new file will be created. Regards, Athi -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html -- Sent via pgsql-general mailing list

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-06 Thread pinker
Actually if the name of the file doesn't matter you could put it into $PGDATA/pg_stat and name it global.stat. When postgres stops (clean or because of failure), replaces the file with his own. So your content will be erased. I'm not sure it's completely safe but works in simple test. -- Sent

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-06 Thread pinker
Look at inotify: https://github.com/rvoicilas/inotify-tools You can check for instance if postmaster.pid exists. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-06 Thread vinny
That seems like an odd requirement and I don't think PostgreSQL can do it itself, because if postgresql should crash properly then the process that should write/remove that file would also crash The simplest way would be to write a cronjob that connects to the database and does a simple query

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-05 Thread Ray Cote
> > On Thu, Oct 5, 2017 at 10:04 AM, athinivas wrote: > >> Hi, >> >> I'm having a requirement to delete a file in system whenever pg server is >> started/crashed. Any idea? >> >> Thanks, >> Athi >> >> If you’re running on Linux you can modify the init.d (or service) file and

Re: [GENERAL] delete a file everytime pg server starts/crashes

2017-10-05 Thread Melvin Davidson
On Thu, Oct 5, 2017 at 10:04 AM, athinivas wrote: > Hi, > > I'm having a requirement to delete a file in system whenever pg server is > started/crashed. Any idea? > > Thanks, > Athi > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-general- > f1843780.html

[GENERAL] delete a file everytime pg server starts/crashes

2017-10-05 Thread athinivas
Hi, I'm having a requirement to delete a file in system whenever pg server is started/crashed. Any idea? Thanks, Athi -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to