From 54805d58558a5cdd277841b626281eb1174970fd Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Thu, 15 Dec 2016 14:34:12 +0100 Subject: [SSPS] php children not dynamic via service file patching (to be debugged!) --- satellit_installer/includes/10-configurations.inc | 15 ++++++++++++++- satellit_installer/includes/50-copyscripts.inc | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'satellit_installer') diff --git a/satellit_installer/includes/10-configurations.inc b/satellit_installer/includes/10-configurations.inc index 5b2b3ab..76448d0 100644 --- a/satellit_installer/includes/10-configurations.inc +++ b/satellit_installer/includes/10-configurations.inc @@ -40,8 +40,21 @@ patch_lighttpd_config() { cd /etc/lighttpd/conf-enabled || perror "Could not cd to conf-enabled." [ ! -h 10-fastcgi.conf ] && ln -s ../conf-available/10-fastcgi.conf [ ! -h 15-fastcgi-php.conf ] && ln -s ../conf-available/15-fastcgi-php.conf + # Increase php threads - sed -i 's/"PHP_FCGI_CHILDREN.*$/"PHP_FCGI_CHILDREN" => "32",/' "15-fastcgi-php.conf" + echo -n "# Patching lighttpd service file..." + if [ -f /lib/systemd/system/lighttpd.service ]; then + # service file found, patching dynamic php children value at system start via patchfile + # see includes/50-copyscripts.inc for dropping patch file /usr/local/sbin/patch_lightdm_phpchildren + if ! grep -q patch_lightdm_phpchildren /lib/systemd/system/lighttpd.service; then + sed -i 's#\[Service\]#\[Service\]\nExecStartPre=\-/usr/local/sbin/patch_lightdm_phpchildren#g' + fi + else + # service file not found, going old static way + sed -i 's/"PHP_FCGI_CHILDREN.*$/"PHP_FCGI_CHILDREN" => "32",/' "15-fastcgi-php.conf" + fi + + mkdir -p "$1" || perror "Could not create $1." } diff --git a/satellit_installer/includes/50-copyscripts.inc b/satellit_installer/includes/50-copyscripts.inc index 8697aa0..ff9573c 100644 --- a/satellit_installer/includes/50-copyscripts.inc +++ b/satellit_installer/includes/50-copyscripts.inc @@ -11,6 +11,28 @@ install_config_static_ip() { echo "ok." } +install_lighttpd_phpchild() { + cat > /usr/local/sbin/patch_lightdm_phpchildren <<-HEREDOC + #!/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 + CHILDREN= $(( $MEM / 16 )) # 16 MB per child + + if [ -f /etc/lighttpd/conf-enabled ]; then + sed -i "s/\"PHP_FCGI_CHILDREN.*$/\"PHP_FCGI_CHILDREN\" => \"$CHILDREN\",/" /etc/lighttpd/conf-enabled/15-fastcgi-php.conf + else + echo "Warning: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf not found!" + exit 1 + fi + exit 0 + HEREDOC + + + +} + install_slxlog() { mkdir -p "/usr/local/bin" cp -a "$BASEDIR/static_files/slxlog" "/usr/local/bin/" || perror "Could not install slxlog" -- cgit v1.2.3-55-g7522