Skip to content

Commit 7a99d66

Browse files
committed
Only parse a single line from lscpu to get the Cpu(s) count.
1 parent 20e33fb commit 7a99d66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

discourse-setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ scale_ram_and_cpu() {
258258
else
259259
avail_gb=$(check_linux_memory)
260260
threads_per_core=$(lscpu | awk 'BEGIN {FS=":"} /Thread\(s\) per core/ {print $2}')
261-
avail_cores=$((`lscpu | awk '/^CPU\(s\)/ {print $2}'`*${threads_per_core}))
261+
avail_cores=$((`lscpu | awk '/^CPU\(s\):[[:blank:]]+[0-9]+[[:blank:]]*$/ {print $2; exit}'`*${threads_per_core}))
262262
fi
263263
echo "Found ${avail_gb}GB of memory and $avail_cores physical CPU cores"
264264

0 commit comments

Comments
 (0)