#!/bin/sh

# Where does your mysql live?
mysql=/usr/local/mysql/bin/mysql

# Get the host and port from the argument (which is the back end,
# as host:port)
host=`echo $1 | sed 's/:.*//'`
port=`echo $1 | sed 's/.*://'`

# Try to connect to the host and port. Print the result on stdout.
echo quit | $mysql -h $host -P $port --protocol=tcp --connect-timeout=3
echo $?
