Re: delete a file everytime pg server starts/crashes

From: vinny <vinny(at)xs4all(dot)nl>
To: athinivas <athinivas(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: delete a file everytime pg server starts/crashes
Date: 2017-10-06 07:07:36
Message-ID: 48b89cc6c36701221ee7ce32fce656ef@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Durgamahesh Manne 2017-10-06 08:44:14 Regarding scram authentication libpq version 10 or more
Previous Message Andres Freund 2017-10-06 03:03:29 Re: Strange checkpoint behavior - checkpoints take a longtime