File: ansible/roles/swap/templates/increase_swap.tpl

Recommend this page to a friend!
  Classes of Omar Shaban  >  PHP Game of Three  >  ansible/roles/swap/templates/increase_swap.tpl  >  Download  
File: ansible/roles/swap/templates/increase_swap.tpl
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Game of Three
Game of Three implementation using Websockets
Author: By
Last change:
Date: 3 months ago
Size: 506 bytes


Class file image Download

# size of swapfile in megabytes
swapsize={{ server.swap_size }}

# does the swap file already exist?
grep -q "swapfile" /etc/fstab

# if not then create it
if [ $? -ne 0 ]; then
echo 'swapfile not found. Adding swapfile.'
fallocate -l ${swapsize}M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap defaults 0 0' >> /etc/fstab
echo 'swapfile found. No changes made.'

# output results to terminal
df -h
cat /proc/swaps
cat /proc/meminfo | grep Swap
For more information send a message to info at phpclasses dot org.