#!/bin/bash

# This script will force PostgreSQL master on this node

MASTER=`hostname`

echo
echo "Are you sure to make PostgreSQL master node at $MASTER?"
echo
echo "This script will execute:"
echo " * crm_attribute -l forever -N $MASTER -n PostgreSQL-data-status -v LATEST"
echo
read -p"Type YES to force PostgreSQL master node at $MASTER: " answer
echo
if [ "$answer" != "YES" ]; then
    echo "Terminating..."
    exit 1
fi

crm_attribute -l forever -N $MASTER -n PostgreSQL-data-status -v LATEST
