add snap before update

This commit is contained in:
2024-02-14 09:24:00 +01:00
parent c3e9de982d
commit 198223ddc7
3 changed files with 9 additions and 5 deletions

View File

@@ -6,6 +6,8 @@ BRed='\033[1;31m' # Red
BGreen='\033[1;32m' # Green
Color_Off='\033[0m' # Text Reset
TMSTMP=$(date +'%Y%m%d%H%M%S')
function stop_container() {
lxc stop ${1}
echo -e $(date) "- ${BGreen}Container ${1} stopped${Color_Off}"
@@ -13,6 +15,8 @@ function stop_container() {
echo $(date) "- Start updating LXC container..."
for cont_name in $(lxc list type=container -c n --format csv); do
echo $(date) "- Make ${cont_name} container snapshot..."
lxc snapshot ${cont_name}
echo $(date) "- Updating ${cont_name} container..."
Status=$(lxc list type=container -c ns --format csv | grep ${cont_name} | cut -d',' -f 2)
if [ "${Status}" == "STOPPED" ]; then