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 to see if things are ok, and act accordingly. But cronjobs cannot be executed more than once a miunute so there would be a considerable delay.

If you need faster responses you may need to write a custom deamon or use something like supervisord to manage a long polling script.

I get the feeling there must be a more elegant solution to whatever your problem is though...

On 2017-10-05 16:04, 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


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

Reply via email to