Sha256: c355ce1f8ab701401892833b8dac2197170e4bda63d2986981530dc9057eee3a

Contents?: true

Size: 455 Bytes

Versions: 4

Compression:

Stored size: 455 Bytes

Contents

swapfile_location = "/swapfile"
swap_in_megabytes = 512

execute "create swapfile" do
  command "dd if=/dev/zero of=#{swapfile_location} bs=1024 count=#{swap_in_megabytes*1024}"
  not_if { File.exists?(swapfile_location) }
end

execute "mkswap" do
  command "mkswap /swapfile"
  not_if "file #{swapfile_location} | grep -q 'swap file'"
end

execute "swapon" do
  command "swapon #{swapfile_location}"
  not_if "cat /proc/swaps  | grep -q '/swapfile'"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lobot-0.10.3 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.10.2 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.10.1 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.10.0 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb