From 3b16599b6f59ad1ebe4e11d56c0f3ee1267741f6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 27 Nov 2014 19:44:46 +0000 Subject: [PATCH] Optimise web server for number of cpu cores --- install-freedombone.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install-freedombone.sh b/install-freedombone.sh index 0a36022d..853e4b05 100755 --- a/install-freedombone.sh +++ b/install-freedombone.sh @@ -106,6 +106,9 @@ CONFIGURATION_FILE="freedombone.cfg" SSH_PORT=2222 +# number of CPU cores +CPU_CORES=1 + # The static IP address of the system within the local network LOCAL_NETWORK_STATIC_IP_ADDRESS="192.168.1.60" @@ -341,6 +344,9 @@ function read_configuration { if grep -q "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE; then LOCAL_NETWORK_STATIC_IP_ADDRESS=$(grep "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "CPU_CORES" $CONFIGURATION_FILE; then + CPU_CORES=$(grep "CPU_CORES" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "WEBSERVER_LOG_LEVEL" $CONFIGURATION_FILE; then WEBSERVER_LOG_LEVEL=$(grep "WEBSERVER_LOG_LEVEL" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi @@ -2997,6 +3003,8 @@ function install_web_server { exit 51 fi + sed -i "s/worker_processes 4;/worker_processes $CPU_CORES;/g" /etc/nginx/nginx.conf + # install a script to easily enable and disable nginx virtual hosts if [ ! -d $INSTALL_DIR ]; then mkdir $INSTALL_DIR