#!/bin/sh

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

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

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