-
-
Save radamuz/7d4c23a06a003d8f062e98bb2bd9cd69 to your computer and use it in GitHub Desktop.
Revisions
-
radamuz revised this gist
Sep 24, 2024 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,18 +9,18 @@ if [ ! -f /proc/meminfo ]; then fi # Lee la primera línea del archivo /proc/meminfo que contiene "MemTotal" line=\$(grep -m 1 "MemTotal" /proc/meminfo) # Verifica si la línea contiene la palabra "MemTotal" y "kB" if [[ "\$line" == *"MemTotal"* && "\$line" == *"kB"* ]]; then # Extrae el valor numérico de la memoria memory_kb=\$(echo \$line | grep -oP '\d+') # Si se pudo extraer el valor if [ -n "\$memory_kb" ]; then # Calcula el 90% de la memoria en kB y conviértela a MB memory_mb=\$(echo "(\$memory_kb * 0.9) / 1024" | bc) echo "\$memory_mb" else echo 1024 fi -
radamuz revised this gist
Sep 24, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ else fi EOF memory_max_mb=$(bash $memory_estimate_script) export JAVA_HOME=/opt/java export JAVA_OPTS="-Xms512m -Xmx"$memory_max_mb"m -XX:+UseParallelGC -Duser.timezone=Asia/Taipei -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true " -
radamuz revised this gist
Sep 24, 2024 . 1 changed file with 25 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,32 @@ memory_estimate_script=$(mktemp /tmp/tmp.XXXXXXXXXX) cat << EOF > $memory_estimate_script #!/bin/bash # Verifica si existe el archivo /proc/meminfo if [ ! -f /proc/meminfo ]; then echo 1024 exit 0 fi # Lee la primera línea del archivo /proc/meminfo que contiene "MemTotal" line=$(grep -m 1 "MemTotal" /proc/meminfo) # Verifica si la línea contiene la palabra "MemTotal" y "kB" if [[ "$line" == *"MemTotal"* && "$line" == *"kB"* ]]; then # Extrae el valor numérico de la memoria memory_kb=$(echo $line | grep -oP '\d+') # Si se pudo extraer el valor if [ -n "$memory_kb" ]; then # Calcula el 90% de la memoria en kB y conviértela a MB memory_mb=$(echo "($memory_kb * 0.9) / 1024" | bc) echo "$memory_mb" else echo 1024 fi else echo 1024 fi EOF memory_max_mb=$(python $memory_estimate_script) -
radamuz revised this gist
Sep 24, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ with open("/proc/meminfo") as fh: if "MemTotal" in line and "kB" in line: m = re.search("\d+", line) if m: memory_kb = float(m.group()) * 0.9 memory_mb = int(memory_kb / 1024) print(memory_mb) else: -
radamuz revised this gist
Sep 24, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ cat << EOF > $memory_estimate_script import re import os.path if not os.path.exists("/proc/meminfo"): print(1024) with open("/proc/meminfo") as fh: line = fh.readline() @@ -12,9 +12,9 @@ with open("/proc/meminfo") as fh: if m: memory_kb = float(m.group()) * 0.7 memory_mb = int(memory_kb / 1024) print(memory_mb) else: print(1024) EOF memory_max_mb=$(python $memory_estimate_script) -
qrtt1 created this gist
Sep 5, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ memory_estimate_script=$(mktemp /tmp/tmp.XXXXXXXXXX) cat << EOF > $memory_estimate_script import re import os.path if not os.path.exists("/proc/meminfo"): print 1024 with open("/proc/meminfo") as fh: line = fh.readline() if "MemTotal" in line and "kB" in line: m = re.search("\d+", line) if m: memory_kb = float(m.group()) * 0.7 memory_mb = int(memory_kb / 1024) print memory_mb else: print 1024 EOF memory_max_mb=$(python $memory_estimate_script) export JAVA_HOME=/opt/java export JAVA_OPTS="-Xms512m -Xmx"$memory_max_mb"m -XX:+UseParallelGC -Duser.timezone=Asia/Taipei -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true " echo "JAVA_OPTS "$JAVA_OPTS