Last active
March 21, 2017 13:32
-
-
Save moodysalem/4abfdf9b7210c4b1a721 to your computer and use it in GitHub Desktop.
ebextensions swapfile creation script ec2 swap
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
commands: | |
000_dd: | |
test: test ! -e /swapfile | |
command: dd if=/dev/zero of=/swapfile bs=1M count=2048 && chmod 600 /swapfile | |
001_mkswap: | |
command: mkswap /swapfile | |
ignoreErrors: true | |
002_swapon: | |
command: swapon /swapfile | |
ignoreErrors: true |
This will work only 1st time;
swapon /swapfile
will work only until restart. swapfile is not added to fstab.
On 2nd run it will detect that /swapfile exists and do nothing.
Changed it to just always try mkswap and swapon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creates a 2gb swapfile for use on amazon t2.nano instances