#!/bin/bash
# 
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2010, 2013, 2014, 2015, 2016 Synacor, Inc.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software Foundation,
# version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
# ***** END LICENSE BLOCK *****
# 

source `dirname $0`/zmshutil || exit 1
zmsetvars

if [ x"${antispam_mysql_host}" = x`zmhostname` -o x"${antispam_mysql_host}" = "xlocalhost" -o x"${antispam_mysql_host}" = "x127.0.0.1" -o x"${antispam_mysql_host}" = "x::1" ]; then
    exec /opt/zimbra/common/bin/mysql \
        --socket=${antispam_mysql_socket} \
        --user=${antispam_mysql_user} \
        --password=${antispam_mysql_password} "$@"
else
    exec /opt/zimbra/common/bin/mysql \
        --host=${antispam_mysql_host} \
        --port=${antispam_mysql_port} \
        --user=${antispam_mysql_user} \
        --password=${antispam_mysql_password} "$@"
fi

