--- alx-src/trunk/alxconfig-ng/functions/mysqlfunctions 2005/04/12 20:46:52 239 +++ alx-src/trunk/alxconfig-ng/functions/mysqlfunctions 2005/08/17 21:20:39 284 @@ -6,7 +6,7 @@ # # Niels Rogalla # -# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/mysqlfunctions,v 1.3 2005-04-12 20:45:55 niro Exp $ +# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/mysqlfunctions,v 1.4 2005-08-17 21:20:39 niro Exp $ mysql_command(){ @@ -104,3 +104,33 @@ EOF [ "${SHOWTABLES}" == true ] || echo "${i}" } + +beep3x() { + echo -en "\a" + sleep 0.7 + echo -en "\a" + sleep 0.7 + echo -en "\a" +} + +reach_mysql_server() +{ + # set connection timeout to 5 secs + mysql --connect_timeout=5 \ + --user=${SQL_USER} \ + --password=${SQL_PASS} \ + --host=${SQL_HOST} \ + --database=${SQL_DB} \ + --batch \ + --execute="" $> /dev/null && return 0 || \ + ( + echo -e ${COLRED} + echo "Cannot reach a mysql-server at '${SQL_HOST}'." + echo "None of the current settings of this client will be touched." + echo "Please inform your system-administrator." + echo -e ${COLDEFAULT} + beep3x + sleep 5 + return 1 + ) +}