Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2019-02-23 20:37:27 +0300
committernachoparker <nacho@ownyourbits.com>2019-03-05 21:22:12 +0300
commitbf1fc1fd87b3efac2c8051e8bf09385f4e34460d (patch)
tree7bbf45460396781ab1a1f560c6d297f77d0c78ae
parent54565e476d77cfde958501c38b31213687d60f6d (diff)
nc-limits: autocalculate database memoryv1.8.3
-rw-r--r--bin/ncp/CONFIG/nc-limits.sh15
-rw-r--r--changelog.md6
2 files changed, 17 insertions, 4 deletions
diff --git a/bin/ncp/CONFIG/nc-limits.sh b/bin/ncp/CONFIG/nc-limits.sh
index 55e37ed7..219b426e 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 51dfadf8..3000d255 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