File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
src/packages/server/compute/cloud Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -382,7 +382,15 @@ docker rm filesystem >/dev/null 2>&1
382
382
383
383
setState filesystem run '' 45 25
384
384
385
- export TOTAL_RAM=$(free -g |grep Mem: | awk '{print $2}')
385
+ # Get the total RAM
386
+ total_ram=$(free -g | grep Mem: | awk '{print $2}')
387
+
388
+ # Compute TOTAL_RAM as MAX(1, total_ram - 1)
389
+ export TOTAL_RAM=$(($total_ram - 1))
390
+ if [ "$TOTAL_RAM" -lt 1 ]; then
391
+ # Obviously 0 wouldn't work below.
392
+ export TOTAL_RAM=1
393
+ fi
386
394
387
395
mkdir -p /ephemeral
388
396
chown 2001:2001 /ephemeral
@@ -464,7 +472,12 @@ docker start compute >/dev/null 2>&1
464
472
465
473
if [ $? -ne 0 ]; then
466
474
setState compute run '' 20 25
467
- export TOTAL_RAM=$(free -g |grep Mem: | awk '{print $2}')
475
+ total_ram=$(free -g | grep Mem: | awk '{print $2}')
476
+ export TOTAL_RAM=$(($total_ram - 1))
477
+ if [ "$TOTAL_RAM" -lt 1 ]; then
478
+ # Obviously 0 wouldn't work below.
479
+ export TOTAL_RAM=1
480
+ fi
468
481
mkdir -p /ephemeral
469
482
chown 2001:2001 /ephemeral
470
483
docker run -d ${ gpu ? GPU_FLAGS : "" } \
You can’t perform that action at this time.
0 commit comments