1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Add a check that there's a reasonable quantity of RAM+swap available

This commit is contained in:
Alexandre Aubin 2019-01-17 21:43:47 +01:00 committed by Alexandre Aubin
parent cc4c8e73e6
commit edf6ab3814

View file

@ -40,6 +40,13 @@ app=$YNH_APP_INSTANCE_NAME
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die "This path already contains a folder"
# TODO : to be factorized into a helper someday ? ;)
MEM=$(free | grep "^Mem" | awk '{print $2}')
SWAP=$(free | grep "^Swap" | awk '{print $2}')
TOTAL_MEM_AND_SWAP=$(( ( $MEM+$SWAP ) / 1024 )) # In MB
[[ $TOTAL_MEM_AND_SWAP -gt 2500 ]] || ynh_die "You need at least 2500 Mo of RAM+Swap to install Mastodon. Please consult the README to learn how to add swap."
# Normalize the url path syntax # Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url) path_url=$(ynh_normalize_url_path $path_url)