#!/bin/bash
#
# Repair Databases
# =================
# This script simply prints a message to contact support staff
# As there is no good automated way to repair an InnoDB database
#

echo ""
echo "Nagios Fusion"
echo "Repair Databases"
echo "****************"
echo ""
echo ""
echo "AUTOMATIC REPAIR UNAVAILABLE!"
echo ""
echo "PLEASE CONTACT NAGIOS SUPPORT STAFF IMMEDIATELY!"
echo ""
echo "Stopping the database..."

BASEDIR=$(dirname $(readlink -f $0))

if "$BASEDIR/manage_services.sh" stop mysqld; then

    echo ""
    echo "Stopping the database succeeded."
    echo ""

else

    echo ""
    echo "Stopping the database failed!"
    echo ""
    echo "You can attempt to manually stop the database service from running"
fi

echo "It is suggested you leave the database in this state until you contact Nagios Support"
echo ""

exit 0
