#!/bin/sh
#
# Check local databases.
#

# PROVIDE: tbdbcheck
# REQUIRE: mysql 
# BEFORE: testbed
# KEYWORD: shutdown

MAINSITE="@TBMAINSITE@"
PROTOGENI="@PROTOGENI_SUPPORT@"
DBNAME="@TBDBNAME@"
LOGFILE="/var/log/mysqlcheck.log"

command=/usr/local/bin/mysqlcheck

case "$1" in
	start|faststart|quietstart|onestart|forcestart)
		rm -f $LOGFILE
		if [ $MAINSITE == "0" ]; then
		    echo "*** Checking $DBNAME ..." >> $LOGFILE
		    $command --auto-repair $DBNAME >> $LOGFILE
		fi
		if [ $PROTOGENI != "0" ]; then
		    echo "*** Checking geni ..." >> $LOGFILE
		    $command --auto-repair geni >> $LOGFILE
		    echo "*** Checking geni-ch ..." >> $LOGFILE
		    $command --auto-repair geni-ch >> $LOGFILE
		    echo "*** Checking geni-cm ..." >> $LOGFILE
		    $command --auto-repair geni-cm >> $LOGFILE
		fi
		;;
	stop|faststop|quietstop|onestop|forcestop)
		;;
	*)
		echo ""
		echo "Usage: `basename $0` { start | stop }"
		echo ""
		exit 64
		;;
esac
exit 0

#!/bin/sh
#
# Check local databases.
#

# PROVIDE: tbdbcheck
# REQUIRE: mysql 
# BEFORE: testbed
# KEYWORD: shutdown

MAINSITE="@TBMAINSITE@"
PROTOGENI="@PROTOGENI_SUPPORT@"
DBNAME="@TBDBNAME@"
LOGFILE="/var/log/mysqlcheck.log"

command=/usr/local/bin/mysqlcheck
socket=/tmp/mysql.sock

case "$1" in
	start|faststart|quietstart|onestart|forcestart)
		if [ ! -e "$socket" ]; then
		    sleep 10
		fi
		rm -f $LOGFILE
		if [ $MAINSITE == "0" ]; then
		    echo "*** Checking $DBNAME ..." >> $LOGFILE
		    $command --auto-repair $DBNAME >> $LOGFILE
		fi
		if [ $PROTOGENI != "0" ]; then
		    echo "*** Checking geni ..." >> $LOGFILE
		    $command --auto-repair geni >> $LOGFILE
		    echo "*** Checking geni-ch ..." >> $LOGFILE
		    $command --auto-repair geni-ch >> $LOGFILE
		    echo "*** Checking geni-cm ..." >> $LOGFILE
		    $command --auto-repair geni-cm >> $LOGFILE
		fi
		echo -n ' tbdbcheck'
		;;
	stop|faststop|quietstop|onestop|forcestop)
		;;
	*)
		echo ""
		echo "Usage: `basename $0` { start | stop }"
		echo ""
		exit 64
		;;
esac
exit 0

Add small delay if mysqld socket does not exist; this script runs to soon after mysqld starts, and the socket is not there for a few seconds.
Add small delay if mysqld socket does not exist; this script runs to soon
after mysqld starts, and the socket is not there for a few seconds.
