From 5e401923d59a46c5050116c373c0bc96287821ab Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 20 Jun 2019 01:37:42 +0200 Subject: [PATCH] Remove swap before creating snapshots --- sub_scripts/launcher.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sub_scripts/launcher.sh b/sub_scripts/launcher.sh index eebcca1..bb2741a 100755 --- a/sub_scripts/launcher.sh +++ b/sub_scripts/launcher.sh @@ -75,6 +75,14 @@ create_temp_backup () { # Stop the container, before its snapshot sudo lxc-stop --name $lxc_name >&2 + # Remove swap files to avoid killing the CI with huge snapshots. + local swap_file="/var/lib/lxc/$lxc_name/rootfs/swap_$ynh_app_id" + if [ -e "$swap_file" ] + then + sudo swapoff "$swap_file" + sudo rm "$swap_file" + fi + # Check if the snapshot already exist if [ ! -e "$snapshot_path/snap$snap_number" ] then