#!/bin/sh

/etc/init.d/mysqld status
if [ $? != 0 ]; then
    /etc/init.d/mysqld start
    STOP_MYSQL=1
fi

mysql -e "select 1=1" owamp &> /dev/null
if [ $? != 0 ]; then
    echo | /opt/perfsonar_ps/perfsonarbuoy_ma/bin/owdb.pl -i root
fi

if [ "${STOP_MYSQL}" = "1" ]; then
    /etc/init.d/mysqld stop
fi
