mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Improving ynh_lxc_swapfiles_clean
This commit is contained in:
parent
7af7f02a74
commit
8f91c6e28c
1 changed files with 4 additions and 6 deletions
10
lib/ynh_lxd
10
lib/ynh_lxd
|
@ -344,12 +344,10 @@ ynh_lxc_swapfiles_clean () {
|
|||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
# Restart it if needed
|
||||
if [ "$(lxc info $name | grep Status | awk '{print tolower($2)}')" != "running" ]; then
|
||||
_ynh_lxc_start_and_wait --name=$name
|
||||
fi
|
||||
lxc exec $name -- bash -c 'for swapfile in $(ls /swap_* 2>/dev/null); do swapoff $swapfile; done'
|
||||
lxc exec $name -- bash -c 'for swapfile in $(ls /swap_* 2>/dev/null); do rm -f $swapfile; done'
|
||||
_ynh_lxc_start_and_wait --name=$name
|
||||
|
||||
ynh_lxc_run_inside --name=$name --command='for swapfile in $(ls /swap_* 2>/dev/null); do swapoff $swapfile; done'
|
||||
ynh_lxc_run_inside --name=$name --command='for swapfile in $(ls /swap_* 2>/dev/null); do rm -f $swapfile; done'
|
||||
}
|
||||
|
||||
# Check if a snapshot exist for an LXC container
|
||||
|
|
Loading…
Add table
Reference in a new issue