# HG changeset patch
# User Keisuke MORI <kskmori@intellilink.co.jp>
# Date 1257762520 -32400
# Node ID 9dc9a98088aacfd9ef6242843a86dcff575870b3
# Parent  303955555f34c166b5ed00da7a0074db00e8dfdc
# Remove the previous backup_label if it exists.

diff -r 303955555f34 -r 9dc9a98088aa heartbeat/pgsql
--- a/heartbeat/pgsql	Thu Nov 05 14:24:15 2009 +0100
+++ b/heartbeat/pgsql	Mon Nov 09 19:28:40 2009 +0900
@@ -187,6 +187,12 @@
 	# Remove postmastre.pid if it exists
 	rm -f $PIDFILE
 
+	# Remove backup_label if it exists
+	if [ -f $BACKUPLABEL ]; then
+	    ocf_log info "Removing $BACKUPLABEL. The previous backup might be failed."
+	    rm -f $BACKUPLABEL
+	fi
+
         # Check if we need to create a log file
         if ! check_log_file $OCF_RESKEY_logfile
 	then
@@ -398,6 +404,7 @@
 : ${OCF_RESKEY_stop_escalate=30}
 
 PIDFILE=${OCF_RESKEY_pgdata}/postmaster.pid
+BACKUPLABEL=${OCF_RESKEY_pgdata}/backup_label
 
 case "$1" in
     methods)    pgsql_methods
