diff --git a/src/lib/ee_lib_create_swap.sh b/src/lib/ee_lib_create_swap.sh new file mode 100644 index 00000000..91f50c7b --- /dev/null +++ b/src/lib/ee_lib_create_swap.sh @@ -0,0 +1,23 @@ +# EasyEngine Swap creation + +function ee_lib_create_swap() +{ + # Use dd command to create SWAP + # Swap Parameters: + # Location: /swapfile + # Block Size: 1024 + dd if=/dev/zero of=/swapfile bs=1024 count=1024k \ + || ee_lib_error "Unable to generate /swapfile, exit status = " $? + + # Create it as a Swap + mkswap /swapfile \ + || ee_lib_error "Unable to create swapfile, exit status = " $? + + # On the Swap + swapon /swapfile \ + || ee_lib_error "Unable to on Swap, exit status = " $? + + # Add entry into /etc/fstab + echo "/swapfile none swap sw 0 0" >> /etc/fstab \ + || ee_lib_error "Unable to add entry into /etc/fstab, exit status = " $?" +} diff --git a/src/lib/ee_lib_ram.sh b/src/lib/ee_lib_ram.sh index a6b24461..be49e400 100644 --- a/src/lib/ee_lib_ram.sh +++ b/src/lib/ee_lib_ram.sh @@ -11,11 +11,13 @@ function ee_lib_ram() EE_MEMCACHE_SIZE="64" EE_PHP_MAX_CHILDREN="10" EE_SETUP_MAILSCANNER="no" + EE_SWAP="1024" # RAM > 512MB and RAM < 1024MB elif [ $EE_TOTAL_RAM -gt 512 ] && [ $EE_TOTAL_RAM -le 1024 ]; then EE_OPCACHE_SIZE="128" EE_MEMCACHE_SIZE="128" EE_PHP_MAX_CHILDREN="10" + EE_SWAP="1024" # RAM > 1024MB and RAM < 2048MB elif [ $EE_TOTAL_RAM -gt 1024 ] && [ $EE_TOTAL_RAM -le 2048 ]; then EE_OPCACHE_SIZE="256"