phyllomeos/scripts/system-memory.sh
2025-05-21 17:35:57 +02:00

15 lines
487 B
Bash
Executable File

#!/bin/bash
# Read the total memory from /proc/meminfo in MiB
total_memory=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
# Convert to MiB by dividing by 1024 (since MemTotal is in KiB)
total_memory_mb=$(( total_memory / 1024 ))
if [[ "$total_memory_mb" -lt "2048" ]]; then
echo "Not enough RAM: The system has only ${total_memory_mb}MiB of RAM, but at least 2048 MiB is required."
exit 1
else
echo "Sufficient memory available. System has ${total_memory_mb}MiB of RAM."
fi