Implement ynh_lxc_is_started

This commit is contained in:
yalh76 2022-10-24 01:46:12 +02:00
parent 3d6c925048
commit 9637d647af

View file

@ -46,6 +46,28 @@ ynh_lxc_status () {
fi
}
# Check if an LXC container is running
#
# usage: ynh_lxc_is_started --name=name
# | arg: -n, --name= - name of the LXC
#
# Requires YunoHost version *.*.* or higher.
ynh_lxc_is_started () {
# Declare an array to define the options of this helper.
local legacy_args=n
local -A args_array=([n]=name=)
local name
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
if [ "$(ynh_lxc_status --name=$name)" == Running ]
then
return 0
else
return 1
fi
}
# Stopping an LXC container
#
# usage: ynh_lxc_stop --name=name