/etc/monit.d/bins/mysqlcheck.sh being overwritten

I’m updating my mysqlcheck.sh to:

#!/bin/sh
[[ -f /etc/sysconfig/argos ]] && . /etc/sysconfig/argos
declare -x HOME=/root
MYSQLBIN=/usr/bin/mysql
[[ -L /usr/bin/mysql ]] && MYSQLBIN=“$(readlink /usr/bin/mysql)”
MAXCONN=${MYSQL_MAXCONN:-100}
CONNECTED=$(echo ‘show status where variable_name = “Threads_connected”;’ | “$MYSQLBIN” --connect-timeout=10 -rq --column-names=false | awk ‘{print $2}’)

Don’t trigger a restart if MySQL is starting up…

[[ -z $CONNECTED || $CONNECTED -lt $MAXCONN ]]
RET=$?
echo $CONNECTED
exit $RET

As we handle a lot of concurrent connections, although it keeps reverting to 40 max connections, which is constantly killing my MySQL process.

That file may not be directly modified. To increase the connection threshold, create a file named /etc/sysconfig/argos if it does not already exist. In it add the following line:

MYSQL_MAXCONN=100

Got it, just made the change. Thank you.