This commit is contained in:
2025-04-04 17:37:07 +02:00
parent 1b0b27d94a
commit 2ebbdc4d84

View File

@@ -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}"