mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Remove swap before restoring a snapshot
This commit is contained in:
parent
2ee8d7941f
commit
1a8ca9d37a
1 changed files with 5 additions and 0 deletions
|
@ -59,6 +59,11 @@ CREATE_LXC_SNAPSHOT () {
|
||||||
LOAD_LXC_SNAPSHOT () {
|
LOAD_LXC_SNAPSHOT () {
|
||||||
local snapname=$1
|
local snapname=$1
|
||||||
log_debug "Loading snapshot $snapname ..."
|
log_debug "Loading snapshot $snapname ..."
|
||||||
|
|
||||||
|
# Remove swap files before restoring the snapshot.
|
||||||
|
lxc exec $LXC_NAME -- bash -c 'for swapfile in $(ls /swap_* 2>/dev/null); do swapoff $swapfile; done' 2>/dev/null
|
||||||
|
lxc exec $LXC_NAME -- bash -c 'for swapfile in $(ls /swap_* 2>/dev/null); do rm -f $swapfile; done' 2>/dev/null
|
||||||
|
|
||||||
timeout 30 lxc stop --timeout 15 $LXC_NAME 2>/dev/null
|
timeout 30 lxc stop --timeout 15 $LXC_NAME 2>/dev/null
|
||||||
lxc restore $LXC_NAME $snapname
|
lxc restore $LXC_NAME $snapname
|
||||||
lxc start $LXC_NAME
|
lxc start $LXC_NAME
|
||||||
|
|
Loading…
Add table
Reference in a new issue