Thread: Check if backup is in progress

Check if backup is in progress

From
sodik
Date:
Hi,

is there any way how to check that postgres 9.1 is currently in backup mode? 

Imagine the situation that my DB is running and the backup is remotely started by 

# select pg_start_backup('backup', true);

However the remote site crashed and can't stop the backup. Is there any way how to check if something like it happen or somehow configure the timeout for backup procedure? 
Currently only solution that comes to my mind is to try to start another backup, if this fails, I know that it is in progress.

Thanks
Stano

Re: Check if backup is in progress

From
Marti Raudsepp
Date:
On Thu, Feb 16, 2012 at 18:53, sodik <stanislav.miklik+pg@gmail.com> wrote:
> is there any way how to check that postgres 9.1 is currently in backup
> mode?

You can check the existence of the "backup_label" file in your data
directory. If it's there, then a backup is in progress.

If your monitoring system is on a diferent server from the database,
then you can create a custom procedure to check for this file and call
it via SQL.

Regards,
Marti

Re: Check if backup is in progress

From
sodik
Date:
thanks, it looks exactly as I was searching for

On Thu, Feb 16, 2012 at 23:05, Marti Raudsepp <marti@juffo.org> wrote:
On Thu, Feb 16, 2012 at 18:53, sodik <stanislav.miklik+pg@gmail.com> wrote:
> is there any way how to check that postgres 9.1 is currently in backup
> mode?

You can check the existence of the "backup_label" file in your data
directory. If it's there, then a backup is in progress.

If your monitoring system is on a diferent server from the database,
then you can create a custom procedure to check for this file and call
it via SQL.

Regards,
Marti