Last active
July 27, 2018 23:55
-
-
Save limed/78305d85d44541229552d73e43d29989 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/bash | |
# Look at supplied value | |
if [ "$(nubis-metadata status)" == 'ready' ]; then | |
NUBIS_SWAP_SIZE_MEG=$(nubis-metadata NUBIS_SWAP_SIZE_MEG 2>/dev/null) | |
fi | |
# Use sane default otherwise | |
if [ -z "$NUBIS_SWAP_SIZE_MEG" ]; then | |
NUBIS_SWAP_SIZE_MEG=512 | |
fi | |
# Only disabled if explicitely set to 0 | |
if [ "$NUBIS_SWAP_SIZE_MEG" -gt "0" ]; then | |
SWAP_FILE=/var/swap.img | |
echo "Making $NUBIS_SWAP_SIZE_MEG Mb of swap in $SWAP_FILE" | |
dd if=/dev/zero of=$SWAP_FILE bs="1M" count="$NUBIS_SWAP_SIZE_MEG" | |
chmod 600 $SWAP_FILE | |
mkswap $SWAP_FILE | |
swapon $SWAP_FILE | |
fi |
This file contains 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 characters
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: /etc/nubis.d/0-swap: | |
Jul 27 22:22:36 ip-172-16-189-213 kernel: Adding 524284k swap on /var/swap.img. Priority:-1 extents:1 across:524284k SSFS | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: /etc/nubis.d/0-swap: | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: Making 512 Mb of swap in /var/swap.img | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: 512+0 records in | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: 512+0 records out | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: 536870912 bytes (537 MB) copied, 0.362657 s, 1.5 GB/s | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: Setting up swapspace version 1, size = 524284 KiB | |
Jul 27 22:22:36 ip-172-16-189-213 rc.local: nubis-startup: no label, UUID=9a96566a-6546-47eb-961d-846575ca9008 | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: Making 512 Mb of swap in /var/swap.img | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: 512+0 records in | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: 512+0 records out | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: 536870912 bytes (537 MB) copied, 0.362657 s, 1.5 GB/s | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: Setting up swapspace version 1, size = 524284 KiB | |
Jul 27 22:22:36 ip-172-16-189-213 nubis-startup: no label, UUID=9a96566a-6546-47eb-961d-846575ca9008 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment