Re: [GENERAL] delete a file everytime pg server starts/crashes - Mailing list pgsql-general

From vinny
Subject Re: [GENERAL] delete a file everytime pg server starts/crashes
Date
Msg-id 48b89cc6c36701221ee7ce32fce656ef@xs4all.nl
Whole thread Raw
In response to [GENERAL] delete a file everytime pg server starts/crashes  (athinivas <athinivas@gmail.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Andres Freund
Date:
Subject: Re: [GENERAL] Strange checkpoint behavior - checkpoints take alongtime
Next
From: Durgamahesh Manne
Date:
Subject: [GENERAL] Regarding scram authentication libpq version 10 or more