Compare commits

..
Author SHA1 Message Date
MickLesk b81b4d29a0 Run the execute command once per container and keep going on failure
The "has no command" check ran the whole command, so every command ran
twice and any non-zero exit was reported as a missing command. The real
run sat under errexit, so the first container where the command failed
ended the run and the remaining selected containers were never visited,
which made the selection look random. Run the command once, report its
exit code per container, and show the ID next to the name.
2026-11-20 17:00:35 +01:00
3 changed files with 14 additions and 18 deletions

No files matched your search

-4
View File
@@ -592,10 +592,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
- Stalwart: migrate to v1 with stalwart-migrate [@MickLesk](https://github.com/MickLesk) ([#18794](https://github.com/community-scripts/ProxmoxVE/pull/18794))
### 💾 Core
- fix: vm - name why an image step failed and open one message for the disk import [@MickLesk](https://github.com/MickLesk) ([core#279](https://github.com/community-scripts/core/pull/279))
## 2026-11-19
### 🆕 New Scripts
-5
View File
@@ -68,11 +68,6 @@ yq -i "
(map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\" and . != \"INITIAL_ADMIN_EMAIL=*\" and . != \"INITIAL_ADMIN_PASSWORD=*\")) +
[\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\", \"INITIAL_ADMIN_EMAIL=admin@local.com\", \"INITIAL_ADMIN_PASSWORD=${ADMIN_PASS}\"])
" /opt/compose.yaml
# nginx in the NPMplus image cannot parse a link-local resolver with a zone ID (fe80::1%eth0)
DNS_SERVERS="$(awk '/^nameserver/ && $2 !~ /%/ {print $2}' /etc/resolv.conf)"
if grep -qE '^nameserver[[:space:]]+[^[:space:]]*%' /etc/resolv.conf && [[ -n "$DNS_SERVERS" ]]; then
DNS_SERVERS="$DNS_SERVERS" yq -i '.services.npmplus.dns = (strenv(DNS_SERVERS) | split("\n"))' /opt/compose.yaml
fi
{
echo "NPMplus Credentials"
echo "Email: admin@local.com"
+14 -9
View File
@@ -51,18 +51,20 @@ header_info
echo "One moment please...\n"
function execute_in() {
container=$1
name=$(pct exec "$container" hostname)
echo -e "${BL}[Info]${GN} Execute inside${BL} ${name}${GN} with output: ${CL}"
if ! pct exec "$container" -- bash -c "command ${custom_command} >/dev/null 2>&1"; then
echo -e "${BL}[Info]${GN} Skipping ${name} ${RD}$container has no command: ${custom_command}"
else
pct exec "$container" -- bash -c "${custom_command}" | tee
local container=$1 name rc=0
name=$(pct config "$container" | awk '/^hostname:/ {print $2}')
echo -e "${BL}[Info]${GN} Execute inside${BL} ${container} (${name})${GN} with output: ${CL}"
# Run once; a failure in one container must not end the run for the others.
pct exec "$container" -- bash -c "${custom_command}" | tee || rc=$?
if [ "$rc" -eq 127 ]; then
echo -e "${BL}[Info]${RD} ${container} (${name}) has no command: ${custom_command}${CL}"
elif [ "$rc" -ne 0 ]; then
echo -e "${BL}[Info]${RD} Command exited with code ${rc} in ${container} (${name})${CL}"
fi
}
for container in $(pct list | awk '{if(NR>1) print $1}'); do
if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then
if [[ " ${excluded_containers} " == *" ${container} "* ]]; then
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}"
else
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
@@ -75,7 +77,10 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
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}"
pct start "$container"
if ! pct start "$container"; then
echo -e "${BL}[Info]${RD} Skipping ${container}, it did not start${CL}"
continue
fi
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL}"
sleep 5
execute_in "$container"