trove/contrib/dbaas-mycnf/test/build_templates.sh
Nirmal Ranganathan 46108e36f1 Disabling local-infile in my.cnf
Adding max_user_connections and updating max_connections to +10 of user_connections.
2012-06-18 10:42:55 -05:00

25 lines
807 B
Bash
Executable File

#!/bin/sh
# Define the various templates
MEMSIZE=( "512M:1" "1G:2" "2G:4" "4G:8" "8G:16" "16G:32" "32G:64" )
# Create the individual templates from the master template
for i in "${MEMSIZE[@]}"; do
key=${i%%:*}
multiplier=${i##*:}
cat ../etc/my.cnf.base | while read line; do
if [[ `expr "$line" : ".*{.*}"` != "0" ]]; then
oldval=`echo $line | sed -e 's/.*{\(.*\)}.*/\1/'`
prop=`echo $line | sed -e 's/^\(.*\) = {100}/\1/'`
if [[ $prop == "max_connections" ]]; then
newval=`echo "($oldval * $multiplier) + 10" | bc`
else
newval=`echo "$oldval * $multiplier" | bc`
fi
line=`echo $line | sed -e "s/{$oldval}/$newval/"`
fi
echo $line >> etc/my.cnf.$key
done
done