1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/discourse_ynh.git synced 2024-09-03 18:26:18 +02:00

Make the swapiness 10

Discourse recommends a swapiness of 10 not 50. For example on some servers, like mine, you cannot change the swapiness and it is usually 10. Makes more sense I think.
This commit is contained in:
Tio 2023-09-25 14:51:10 +02:00 committed by Salamandar
parent d89a0bd18a
commit 0e5b286d06

View file

@ -32,10 +32,10 @@ is_swap_present() {
[ $(awk '/^SwapTotal:/{print $2}' /proc/meminfo) -gt 0 ] [ $(awk '/^SwapTotal:/{print $2}' /proc/meminfo) -gt 0 ]
} }
# Returns true if swappiness higher than 50 # Returns true if swappiness higher than 10
# usage: is_swappiness_sufficient # usage: is_swappiness_sufficient
is_swappiness_sufficient() { is_swappiness_sufficient() {
[ $(cat /proc/sys/vm/swappiness) -gt 50 ] [ $(cat /proc/sys/vm/swappiness) -gt 10 ]
} }
# Returns true if specified free memory is available (RAM + swap) # Returns true if specified free memory is available (RAM + swap)
@ -53,7 +53,7 @@ check_memory_requirements() {
if ! is_swap_present ; then if ! is_swap_present ; then
ynh_die --message="You must have a swap partition in order to install and use this application" ynh_die --message="You must have a swap partition in order to install and use this application"
elif ! is_swappiness_sufficient ; then elif ! is_swappiness_sufficient ; then
ynh_die --message="Your swappiness must be higher than 50; please see https://en.wikipedia.org/wiki/Swappiness" ynh_die --message="Your swappiness must be higher than 10; please see https://en.wikipedia.org/wiki/Swappiness"
elif ! is_memory_available 1000000 ; then elif ! is_memory_available 1000000 ; then
ynh_die --message="You must have a minimum of 1Gb available memory (RAM+swap) for the installation" ynh_die --message="You must have a minimum of 1Gb available memory (RAM+swap) for the installation"
fi fi