diff --git a/modules/swap/module.py b/modules/swap/module.py index ffedbab..7fb7827 100644 --- a/modules/swap/module.py +++ b/modules/swap/module.py @@ -126,6 +126,15 @@ class SwapModule(AbstractModule): return disable_swapfile = "sudo swapoff {} && ".format(swap_location) + \ "sudo rm {}".format(swap_location) + if self._check_fstab_entry() is True: + with open("/etc/fstab", "r") as fstab_out: + content = fstab_out.readlines() + with open("/etc/fstab", "w") as fstab_in: + content = content[:-1] + for line in content: + fstab_in.write(line) + else: + print("No entry in /etc/fstab!") subprocess.call(disable_swapfile, shell=True) output_swapon = subprocess.check_output(['swapon', '--show']).decode("UTF-8") output_free = subprocess.check_output(['free', '-h']).decode("UTF-8")