Skip to content
Snippets Groups Projects
autodetect-mysqlany 932 B
# ----------------------------------------------------------------------------
# 
# EOL - End of life detection - Warn before reaching end of life
#
# AUTODETECT MYSQL OR A FORK OF IT
#
# ----------------------------------------------------------------------------
# 2021-11-02  v1.0  <axel.hahn@iml.unibe.ch>
# ----------------------------------------------------------------------------

_tmpfile=/tmp/detect_mysql_$$
mysql --version >$_tmpfile 2>&1
if [ $? -ne 0 ]; then
    rm -f $_tmpfile
    ph.abort "UNKNOWN: mysql was not found. A Mysql version cannot be detected."
fi

# ----------------------------------------------------------------------------

# default: mysql
myKey=mysql


# scan for forks:
# todo: add ... percona ... memdb ... whatever
grep "MariaDB" $_tmpfile >/dev/null && myKey=mariadb

rm -f $_tmpfile

# ----------------------------------------------------------------------------

echo "|$myKey|$myVersion"