Skip to content

Instantly share code, notes, and snippets.

@tomaszklim
Last active August 8, 2019 12:06
Show Gist options
  • Save tomaszklim/7c80ea8127bf948b7705b4890c5e208f to your computer and use it in GitHub Desktop.
Save tomaszklim/7c80ea8127bf948b7705b4890c5e208f to your computer and use it in GitHub Desktop.
Configure swap file - eg. on Amazon ECS
#!/bin/sh
if [ ! -f /swapfile ]; then
dd if=/dev/zero of=/swapfile bs=1M count=16384
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
if ! grep -q swapfile /etc/fstab; then
echo "/swapfile none swap sw 0 0" >>/etc/fstab
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment