source: npl/commonservers/mysql_conf/root/service/mysql/run @ a2d969e

perl-5.22
Last change on this file since a2d969e was dd7f574, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

prevent empty config

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/sh
2if [ -e /etc/my.init ];  then
3    INIT="--init-file=/etc/my.init"
4fi
5
6export TMPDIR=/home/system/tmp
7
8### dynamicly configure bufferpool
9#max size of total mysqld=4Gb on 32 bits systems, but there is other stuff in mysqld that uses memory as well. 2200000k seems the maximum for our config on 32 bit
10MAX_POOL=1800000
11
12#total system mem in KB
13MEM_KB=`cat /proc/meminfo | grep MemTotal | sed 's/[^0-9]//g'`
14
15#manual says: pool size 50% of memory, but we use 25% (zarafa also needs a lot)
16(( MEM_POOL = MEM_KB / 4 ))
17if [ "$MEM_POOL" -ge $MAX_POOL ]; then
18        MEM_POOL=$MAX_POOL
19fi
20
21#make the config update atomic. (it happend more then once that during a crash/reset the config file ended up zero bytes )
22cat /etc/my.cnf | sed "s/^innodb_buffer_pool_size.*/innodb_buffer_pool_size = "$MEM_POOL"K/g" > /etc/my.cnf.tmp
23sync
24mv /etc/my.cnf.tmp /etc/my.cnf
25
26cd /
27umask 077
28exec mysqld --basedir=/usr --datadir=/home/system/mysql5 --user=mysql --log-error=/home/system/mysql5/mysql.err --pid-file=/home/system/mysql5/mysql.pid --socket=/var/run/mysql/mysql.sock --port=3306 $INIT
29
Note: See TracBrowser for help on using the repository browser.