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:
Diffstat (limited to 'bin/ncp/CONFIG/nc-limits.sh')
-rw-r--r--bin/ncp/CONFIG/nc-limits.sh15
1 files changed, 12 insertions, 3 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" ]] || \