diff --git a/update-incus-container.sh b/update-incus-container.sh index 73fb208..68c9d95 100755 --- a/update-incus-container.sh +++ b/update-incus-container.sh @@ -10,8 +10,8 @@ TMSTMP=$(date +'%Y%m%d%H%M%S') function stop_container() { echo $(date) "- ${BGreen}Stop container ${1}${Color_Off}" - incus stop ${1} | sed "s/^/$(date) - ${BGreen}${1}${Color_Off} /" - wait + incus stop ${1} | sed "s/^/$(date) - ${BGreen}${1}${Color_Off} /" + wait echo -e $(date) "- ${BGreen}Container ${1} stopped${Color_Off}" } @@ -22,11 +22,11 @@ function update_container() { sleep 2 incus exec ${1} -- sh -c "apt autoremove -y 2>&1" | sed "s/^/$(date) - ${BGreen}${1}${Color_Off} /" sleep 2 - echo -e $(date) "- ${BGreen}Refresh snap packages${Color_Off}" + echo -e $(date) "- ${BGreen}Refresh snap packages for ${1} container...${Color_Off}" incus exec ${1} -- bash -c "if [[ \$(which snap > /dev/null; echo \$?) == 0 ]]; then snap refresh ; fi" | sed "s/^/$(date) - ${BGreen}${1}${Color_Off} /" if [ "${2}" == "STOPPED" ]; then stop_container ${1} - fi + fi } echo $(date) "- ${BGreen}Start updating incus container...${Color_Off}"