Class: Bard::Provision::Swapfile
- Inherits:
-
Bard::Provision
- Object
- Struct
- Bard::Provision
- Bard::Provision::Swapfile
- Defined in:
- lib/bard/provision/swapfile.rb
Overview
setup swapfile
Instance Attribute Summary
Attributes inherited from Bard::Provision
Instance Method Summary collapse
Methods inherited from Bard::Provision
Instance Method Details
#call ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bard/provision/swapfile.rb', line 4 def call print "Swapfile:" provision_server.run! <<~BASH if [ ! -f /swapfile ]; then sudo fallocate -l $(grep MemTotal /proc/meminfo | awk '{print $2}')K /swapfile fi sudo chmod 600 /swapfile sudo swapon --show | grep -q '/swapfile' || sudo mkswap /swapfile sudo swapon --show | grep -q '/swapfile' || sudo swapon /swapfile grep -q '/swapfile none swap sw 0 0' /etc/fstab || echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab BASH puts " ✓" end |