From aef27e6aeb59bdeea25eb834bf40865ad583e727 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 03:51:06 -0500 Subject: [PATCH] Add check system resources for additional jibri node --- add-jibri-node.sh | 44 ++++++++++++++++++++++++++++++++++++++++ quick_jibri_installer.sh | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index f9afa86..1b0327c 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -86,6 +86,50 @@ if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then exit fi +#Check system resources +echo "Verifying System Resources:" +if [ "$(nproc --all)" -lt 4 ];then + echo " +Warning!: The system do not meet the minimum CPU requirements for Jibri to run. +>> We recommend 4 cores/threads for Jibri! +" + CPU_MIN="N" +else + echo "CPU Cores/Threads: OK ($(nproc --all))" + CPU_MIN="Y" +fi +### Test RAM size (8GB min) ### +mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') +if [ ${mem_available} -lt 7700000 ]; then + echo " +Warning!: The system do not meet the minimum RAM requirements for Jibri to run. +>> We recommend 8GB RAM for Jibri! +" + MEM_MIN="N" +else + echo "Memory: OK ($((mem_available/1024)) MiB)" + MEM_MIN="Y" +fi +if [ "$CPU_MIN" = "Y" ] && [ "$MEM_MIN" = "Y" ];then + echo "All requirements seems meet!" + echo " + - We hope you have a nice recording/streaming session + " +else + echo "CPU ($(nproc --all))/RAM ($((mem_available/1024)) MiB) does NOT meet minimum recommended requirements!" + echo "Even when you can use the videconference sessions, we advice to increase the resources in order to user Jibri." + while [[ "$CONTINUE_LOW_RES" != "yes" && "$CONTINUE_LOW_RES" != "no" ]] + do + read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_LOW_RES + if [ "$CONTINUE_LOW_RES" = "no" ]; then + echo "See you next time with more resources!..." + exit + elif [ "$CONTINUE_LOW_RES" = "yes" ]; then + echo "Please keep in mind that trying to use Jibri with low resources might fail." + fi + done +fi + echo " #----------------------------------------------------------------------- # Checking initial necessary variables... diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 6e158c5..3e88205 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -144,7 +144,7 @@ echo " > $(lsb_release -sc), even when it's compatible and functional. We suggest to use the next (LTS) release, for longer support and security reasons." read -n 1 -s -r -p "Press any key to continue..."$'\n' fi -#Check resources +#Check system resources echo "Verifying System Resources:" if [ "$(nproc --all)" -lt 4 ];then echo "