feat: excecute command in LXC: Script exited, when command isn't available in LXC. Added check if command exists in container, otherwise script will skip the container. (#10089)

This commit is contained in:
wolle604
2025-12-18 18:41:31 +00:00
committed by GitHub
parent 0a276749d7
commit 510278960b

View File

@@ -50,7 +50,12 @@ function execute_in() {
container=$1
name=$(pct exec "$container" hostname)
echo -e "${BL}[Info]${GN} Execute inside${BL} ${name}${GN} with output: ${CL}"
pct exec "$container" -- bash -c "${custom_command}" | tee
if ! pct exec "$container" -- bash -c "command -v ${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
fi
}
for container in $(pct list | awk '{if(NR>1) print $1}'); do