Commit 9ecbd7d0 authored by Romain Reuillon's avatar Romain Reuillon
Browse files

Add create swap

parent 5487551f
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
# size of swapfile in megabytes
# 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.'
echo '--------------------------------------------'
echo 'Check whether the swap space created or not?'
echo '--------------------------------------------'
swapon --show
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment