forked from centminmod/centminmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setmycnf.inc
57 lines (44 loc) · 2.63 KB
/
setmycnf.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
setmycnf() {
if [ -f "$(which figlet)" ]; then
figlet -ckf standard "Set /etc/my.cnf"
fi
MYTOTALMEM=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
MYCPUS=$(cat "/proc/cpuinfo" | grep "processor"|wc -l)
# if [[ "$lessmem" = [yY] ]]; then
if [[ "$(expr $MYTOTALMEM \<= 2099000)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-min.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-min.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \> 2100001)" = "1" && "$(expr $MYTOTALMEM \<= 4190000)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \>= 4190001)" = "1" && "$(expr $MYTOTALMEM \<= 8199999)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-4gb.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-4gb.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \>= 8200000)" = "1" && "$(expr $MYTOTALMEM \<= 15999999)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-8gb.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-8gb.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \>= 16000000)" = "1" && "$(expr $MYTOTALMEM \<= 31999999)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-16gb.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-16gb.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \>= 32000000)" = "1" && "$(expr $MYTOTALMEM \<= 63999999)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-32gb.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-32gb.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \>= 64000000)" = "1" && "$(expr $MYCPUS \<= 8)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-64gb-8c.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-64gb-8c.cnf /etc/my.cnf
fi
if [[ "$(expr $MYTOTALMEM \>= 64000000)" = "1" && "$(expr $MYCPUS \>= 12)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-64gb.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-64gb.cnf /etc/my.cnf
elif [[ "$(expr $MYTOTALMEM \>= 64000000)" = "1" && "$(expr $MYCPUS \>= 8)" = "1" ]]; then
echo -e "\nCopying MariaDB my-mdb10-64gb-8c.cnf file to /etc/my.cnf\n"
\cp -f $CUR_DIR/config/mysql/my-mdb10-64gb-8c.cnf /etc/my.cnf
fi
# fi
}