summaryrefslogtreecommitdiffstats
path: root/satellit_installer/static_files
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-24 23:06:29 +0200
committerSimon Rettberg2017-05-24 23:06:29 +0200
commitf5a967fd8db68f4e40b78e25ac88ca3bad2976ec (patch)
tree18c306ecf181695c01d360f32c8e7fc0e2806db1 /satellit_installer/static_files
parent[SSPS] Handle 64bit systems in dmsd.sh and give more mem to java (diff)
downloadsetup-scripts-f5a967fd8db68f4e40b78e25ac88ca3bad2976ec.tar.gz
setup-scripts-f5a967fd8db68f4e40b78e25ac88ca3bad2976ec.tar.xz
setup-scripts-f5a967fd8db68f4e40b78e25ac88ca3bad2976ec.zip
[SSPS] Limit max php children to 128
Diffstat (limited to 'satellit_installer/static_files')
-rwxr-xr-xsatellit_installer/static_files/patch_lighttpd_phpchildren8
1 files changed, 5 insertions, 3 deletions
diff --git a/satellit_installer/static_files/patch_lighttpd_phpchildren b/satellit_installer/static_files/patch_lighttpd_phpchildren
index 229a51d..34c90bb 100755
--- a/satellit_installer/static_files/patch_lighttpd_phpchildren
+++ b/satellit_installer/static_files/patch_lighttpd_phpchildren
@@ -1,10 +1,12 @@
#!/bin/bash
# Could be written in one line, but for better editing when values change...
-MEM=$(grep MemTotal /proc/meminfo|tr -s " "| cut -f 2 -d " ") # RAM
-MEM=$(( $MEM / 1024 / 4 )) # to MB, and a fourth of RAM
-CHILDREN=$(( $MEM / 16 )) # 16 MB per child
+MEM=$(grep ^MemTotal /proc/meminfo | awk '{print $2}') # RAM in KB
+MEM=$(( $MEM / 1024 / 4 )) # to MB, and assess a fourth of RAM for PHP
+CHILDREN=$(( $MEM / 16 )) # assume 16 MB per child
+# min 16, no more than 128
[ $CHILDREN -lt 16 ] && CHILDREN=16
+[ $CHILDREN -gt 128 ] && CHILDREN=128
if [ -f /etc/lighttpd/conf-enabled/15-fastcgi-php.conf ]; then
sed -i "s/\"PHP_FCGI_CHILDREN.*$/\"PHP_FCGI_CHILDREN\" => \"$CHILDREN\",/" /etc/lighttpd/conf-enabled/15-fastcgi-php.conf