mirror of
https://github.com/tteck/Proxmox.git
synced 2024-12-24 22:11:56 +00:00
Update update-lxcs.sh
This commit is contained in:
parent
8ea1e80b3e
commit
28d809649b
@ -32,7 +32,7 @@ containers=$(pct list | tail -n +2 | cut -f1 -d' ')
|
|||||||
|
|
||||||
function update_container() {
|
function update_container() {
|
||||||
container=$1
|
container=$1
|
||||||
echo -e "${BL}[Info]${GN} Updating${BL} $container... ${CL}"
|
echo -e "${BL}[Info]${GN} Updating${BL} $container... ${CL} \n"
|
||||||
# to chain commands within one exec we will need to wrap them in bash
|
# to chain commands within one exec we will need to wrap them in bash
|
||||||
pct exec $container -- bash -c "apt update && apt upgrade -y && apt autoremove -y"
|
pct exec $container -- bash -c "apt update && apt upgrade -y && apt autoremove -y"
|
||||||
}
|
}
|
||||||
@ -41,14 +41,15 @@ for container in $containers
|
|||||||
do
|
do
|
||||||
status=`pct status $container`
|
status=`pct status $container`
|
||||||
if [ "$status" == "status: stopped" ]; then
|
if [ "$status" == "status: stopped" ]; then
|
||||||
echo -e "${BL}[Info]${GN} Starting${BL} $container... ${CL}"
|
echo -e "${BL}[Info]${GN} Starting${BL} $container... ${CL} \n"
|
||||||
pct start $container
|
pct start $container
|
||||||
echo -e "${BL}[Info]${GN} Waiting For${BL} $container To Start... ${CL}"
|
echo -e "${BL}[Info]${GN} Waiting For${BL} $container To Start... ${CL} \n"
|
||||||
sleep 5
|
sleep 5
|
||||||
update_container $container
|
update_container $container
|
||||||
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL}"
|
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
|
||||||
pct shutdown $container &
|
pct shutdown $container &
|
||||||
elif [ "$status" == "status: running" ]; then
|
elif [ "$status" == "status: running" ]; then
|
||||||
update_container $container
|
update_container $container
|
||||||
fi
|
fi
|
||||||
done; wait
|
done; wait
|
||||||
|
echo -e "${GN} Finished, All Containers Updated. ${CL} \n"
|
||||||
|
Loading…
Reference in New Issue
Block a user