DocSpace-client/build/install/OneClickInstall/install-RedHat/tools.sh
Evgeniy Antonyuk eca872cdd8
Add hardware check in deb and rpm OneClickInstall (#479)
* Add hardware check in deb and rpm OneClickInstall

* Modify docker document server run config (#476)

* Revert "Modify docker document server run config (#476)"

This reverts commit 9ed7f71e71ad431386717d37968b97ec2117add8.
2021-12-10 16:26:34 +03:00

35 lines
915 B
Bash

#!/bin/bash
set -e
check_hardware () {
DISK_REQUIREMENTS=40960;
MEMORY_REQUIREMENTS=5500;
CORE_REQUIREMENTS=2;
AVAILABLE_DISK_SPACE=$(df -m / | tail -1 | awk '{ print $4 }');
if [ ${AVAILABLE_DISK_SPACE} -lt ${DISK_REQUIREMENTS} ]; then
echo "Minimal requirements are not met: need at least $DISK_REQUIREMENTS MB of free HDD space"
exit 1;
fi
TOTAL_MEMORY=$(free -m | grep -oP '\d+' | head -n 1);
if [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ]; then
echo "Minimal requirements are not met: need at least $MEMORY_REQUIREMENTS MB of RAM"
exit 1;
fi
CPU_CORES_NUMBER=$(cat /proc/cpuinfo | grep processor | wc -l);
if [ ${CPU_CORES_NUMBER} -lt ${CORE_REQUIREMENTS} ]; then
echo "The system does not meet the minimal hardware requirements. CPU with at least $CORE_REQUIREMENTS cores is required"
exit 1;
fi
}
if [ "$SKIP_HARDWARE_CHECK" != "true" ]; then
check_hardware
fi