[install-federated] Create and activate a swap file in low-RAM configs
This commit is contained in:
parent
237e1b0bc0
commit
ec55682f70
@ -99,6 +99,23 @@ fi
|
|||||||
#IFS=$'\n' read -r -d '' -a EXTRA_APPS_LIST < <(awk -F',' '{ for( i=1; i<=NF; i++ ) print $i }' <<<"$EXTRA_APPS")
|
#IFS=$'\n' read -r -d '' -a EXTRA_APPS_LIST < <(awk -F',' '{ for( i=1; i<=NF; i++ ) print $i }' <<<"$EXTRA_APPS")
|
||||||
#SERVICES=("${CORE_APPS_LIST[@]}" "${EXTRA_APPS_LIST[@]}")
|
#SERVICES=("${CORE_APPS_LIST[@]}" "${EXTRA_APPS_LIST[@]}")
|
||||||
|
|
||||||
|
# Create a swap file if we're in a low RAM configuration
|
||||||
|
MEM=$(LC_ALL=C free |grep ^Mem: |awk '{ print $2; }')
|
||||||
|
if [ "$MEM" -le 2097152 ]; then
|
||||||
|
SWAPSIZE=4096
|
||||||
|
elif [ "$MEM" -le 4194304 ]; then
|
||||||
|
SWAPSIZE=2048
|
||||||
|
else
|
||||||
|
SWAPSIZE=0
|
||||||
|
fi
|
||||||
|
if [ "$SWAPSIZE" -gt 0 ]; then
|
||||||
|
dd if=/dev/zero of=/swap-0001 bs=1M count=$SWAPSIZE
|
||||||
|
chmod 0600 /swap-0001
|
||||||
|
mkswap -v1 /swap-0001
|
||||||
|
echo '/swap-0001 none swap defaults,prio=90 0 2' >>/etc/fstab
|
||||||
|
swapon -a
|
||||||
|
fi
|
||||||
|
|
||||||
# Configure and start each federated core app
|
# Configure and start each federated core app
|
||||||
for i in "${CORE_APPS[@]}"; do
|
for i in "${CORE_APPS[@]}"; do
|
||||||
. /federated/lib/$i.sh
|
. /federated/lib/$i.sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user