diff options
author | Christian Rößler | 2016-12-16 14:53:59 +0100 |
---|---|---|
committer | Christian Rößler | 2016-12-16 14:53:59 +0100 |
commit | 0cd0028158b2d5a80de2d18803746218935a5c04 (patch) | |
tree | 5ed0a4d2a10c7d24559e3ea847c57a5b98759ff4 /satellit_installer | |
parent | [SSPS] php children: leeetle bug, children min. 16 (diff) | |
download | setup-scripts-0cd0028158b2d5a80de2d18803746218935a5c04.tar.gz setup-scripts-0cd0028158b2d5a80de2d18803746218935a5c04.tar.xz setup-scripts-0cd0028158b2d5a80de2d18803746218935a5c04.zip |
[SSPS] php children script to static_files
Diffstat (limited to 'satellit_installer')
-rw-r--r-- | satellit_installer/includes/10-configurations.inc | 8 | ||||
-rw-r--r-- | satellit_installer/includes/50-copyscripts.inc | 24 | ||||
-rwxr-xr-x | satellit_installer/static_files/patch_lighttpd_phpchildren | 15 |
3 files changed, 20 insertions, 27 deletions
diff --git a/satellit_installer/includes/10-configurations.inc b/satellit_installer/includes/10-configurations.inc index 0a58496..6955095 100644 --- a/satellit_installer/includes/10-configurations.inc +++ b/satellit_installer/includes/10-configurations.inc @@ -48,9 +48,11 @@ patch_lighttpd_config() { # 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 echo -n " patching service file ... " - sed -i 's#\[Service\]#\[Service\]\nExecStartPre=\-/usr/local/sbin/patch_lightdm_phpchildren#g' \ - /lib/systemd/system/lighttpd.service - install_lighttpd_phpchild # call to drop patch script + sed -i 's#\[Service\]#\[Service\]\nExecStartPre=\-/usr/local/sbin/patch_lighttpd_phpchildren#g' \ + /lib/systemd/system/lighttpd.service || perror "Could not patch service file!" + cp -a "$BASEDIR/static_files/patch_lighttpd_phpchildren" /usr/local/sbin || \ + perror "Could not copy patch_lighttpd_phpchildren script!" + chmod +x /usr/local/sbin/patch_lighttpd_phpchildren # Just to sleep better in dark nights. fi else # service file not found, going old static way diff --git a/satellit_installer/includes/50-copyscripts.inc b/satellit_installer/includes/50-copyscripts.inc index 49b3113..8697aa0 100644 --- a/satellit_installer/includes/50-copyscripts.inc +++ b/satellit_installer/includes/50-copyscripts.inc @@ -11,30 +11,6 @@ install_config_static_ip() { echo "ok." } -install_lighttpd_phpchild() { - echo -n "# Dropping patch_lightdm_phpchildren script..." - 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 of RAM - CHILDREN=\$(( \$MEM / 16 )) # 16 MB per child - [ \$CHILDREN -lt 16 ] && CHILDREN=16 - - 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 - else - echo "Warning: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf not found!" - exit 1 - fi - exit 0 - - HEREDOC - chmod u+x /usr/local/sbin/patch_lightdm_phpchildren - echo " done." -} - install_slxlog() { mkdir -p "/usr/local/bin" cp -a "$BASEDIR/static_files/slxlog" "/usr/local/bin/" || perror "Could not install slxlog" diff --git a/satellit_installer/static_files/patch_lighttpd_phpchildren b/satellit_installer/static_files/patch_lighttpd_phpchildren new file mode 100755 index 0000000..229a51d --- /dev/null +++ b/satellit_installer/static_files/patch_lighttpd_phpchildren @@ -0,0 +1,15 @@ +#!/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 +[ $CHILDREN -lt 16 ] && CHILDREN=16 + +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 +else + exit 1 +fi +exit 0 + |