move check for existing containers in function
-
change lvlXX from static to sth like "lvl$level_" -
find any container for a module/user/level combo, like " module-lvl
level_-$USER-*" -
switch from "level_stop()" to "lxc delete $container --force" for any $container
something like that, but smarter:
echo -e "\n\nCheck for existing containers..."; sleep .5 # FIXME: that's not yet a smart solution..
lxc info $module-lvl01-$USER-c01 &> /dev/null && ( echo -e "Error: wait for containers to be removed.\n" && (level_stop $module $level 3 &) && exit 1 )
lxc info $module-lvl01-$USER-c02 &> /dev/null && ( echo -e "Error: wait for containers to be removed.\n" && (level_stop $module $level 3 &) && exit 1 )
lxc info $module-lvl01-$USER-c03 &> /dev/null && ( echo -e "Error: wait for containers to be removed.\n" && (level_stop $module $level 3 &) && exit 1 )