diff --git a/bin/ncp/CONFIG/nc-limits.sh b/bin/ncp/CONFIG/nc-limits.sh index 55e37ed74..219b426ee 100644 --- a/bin/ncp/CONFIG/nc-limits.sh +++ b/bin/ncp/CONFIG/nc-limits.sh @@ -36,9 +36,18 @@ configure() [[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$( nproc ) [[ $PHPTHREADS -lt 3 ]] && PHPTHREADS=3 echo "Using $PHPTHREADS PHP threads" - sed -i "s|^pm.max_children =.*|pm.max_children = $PHPTHREADS|" "$CONF" - sed -i "s|^pm.max_spare_servers =.*|pm.max_spare_servers = $PHPTHREADS|" "$CONF" - sed -i "s|^pm.start_servers =.*|pm.start_servers = $PHPTHREADS|" "$CONF" + sed -i "s|^pm =.*|pm = static|" "$CONF" + sed -i "s|^pm.max_children =.*|pm.max_children = $PHPTHREADS|" "$CONF" + + # DATABASE MEMORY + AUTOMEM=$(( TOTAL_MEM * 40 / 100 )) + local CONF=/etc/mysql/mariadb.conf.d/91-ncp.cnf + local CURRENT_DB_MEM=$(grep "^innodb_buffer_pool_size" "$CONF" | awk '{ print $3 }') + echo "Using $AUTOMEM memory for the database" + [[ "$CURRENT_DB_MEM" != "$AUTOMEM" ]] && { + sed -i "s|^innodb_buffer_pool_size =.*|innodb_buffer_pool_size = $AUTOMEM|" "$CONF" + service mysql restart + } # RESTART PHP [[ "$PHPTHREADS" != "$CURRENT_THREADS" ]] || \ diff --git a/changelog.md b/changelog.md index 51dfadf81..3000d2554 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ -[v1.7.1](https://github.com/nextcloud/nextcloudpi/commit/a077130) (2019-02-22) lamp: adjust mariadb parameters +[v1.8.2](https://github.com/nextcloud/nextcloudpi/commit/3315e2e) (2019-02-23) nc-limits: autocalculate database memory + +[v1.8.1 ](https://github.com/nextcloud/nextcloudpi/commit/2a0dc38) (2019-02-22) lamp: adjust mariadb parameters + +[v1.8.0 ](https://github.com/nextcloud/nextcloudpi/commit/602b3f2) (2019-02-23) add nc-maintenance-mode (#809) [v1.7.0](https://github.com/nextcloud/nextcloudpi/commit/5e1ea77) (2019-02-17) add nc-restore-snapshot