mirror of https://github.com/tteck/Proxmox.git
Compare commits
No commits in common. "c18d373ff75c2af44201112ea4089c87e98c577b" and "c47326ff2544b6a507f670b70b32ecbbb71204d7" have entirely different histories.
c18d373ff7
...
c47326ff25
|
@ -2,12 +2,6 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## 2023-03-10
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- **Proxmox LXC Updater**
|
|
||||||
- You can use the command line to exclude multiple containers simultaneously.
|
|
||||||
|
|
||||||
## 2023-03-08
|
## 2023-03-08
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ while true; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
excluded_containers=("$@")
|
exclude_container="$@"
|
||||||
|
containers=$(pct list | tail -n +2 | cut -f1 -d' ' | grep -vE "^($exclude_container)$")
|
||||||
function update_container() {
|
function update_container() {
|
||||||
container=$1
|
container=$1
|
||||||
header_info
|
header_info
|
||||||
|
@ -49,22 +50,10 @@ function update_container() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
header_info
|
header_info
|
||||||
for container in $(pct list | tail -n +2 | cut -f1 -d' '); do
|
for container in $containers; do
|
||||||
excluded=false
|
status=$(pct status $container)
|
||||||
for excluded_container in "${excluded_containers[@]}"; do
|
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
|
||||||
if [ "$container" == "$excluded_container" ]; then
|
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
||||||
excluded=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "$excluded" == true ]; then
|
|
||||||
header_info
|
|
||||||
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}"
|
|
||||||
sleep 1
|
|
||||||
else
|
|
||||||
status=$(pct status $container)
|
|
||||||
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
|
|
||||||
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
|
||||||
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
|
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${CL}${GN} To Start ${CL} \n"
|
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
|
||||||
|
@ -74,7 +63,6 @@ for container in $(pct list | tail -n +2 | cut -f1 -d' '); do
|
||||||
pct shutdown $container &
|
pct shutdown $container &
|
||||||
elif [ "$status" == "status: running" ]; then
|
elif [ "$status" == "status: running" ]; then
|
||||||
update_container $container
|
update_container $container
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
|
|
Loading…
Reference in New Issue