trove/contrib/dbaas-mycnf/test/build_templates.sh
Michael Basnight b3c31e0608 Adding dbaas-mycnf to the contrib folder
* Added logging configs to the guestagent
2012-03-19 23:06:08 -05:00

20 lines
588 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/'`
newval=`echo "$oldval * $multiplier" | bc`
line=`echo $line | sed -e "s/{$oldval}/$newval/"`
fi
echo $line >> etc/my.cnf.$key
done
done