bkctld: Replace xargs with a simple loop

This commit is contained in:
Jérémy Lecour 2020-10-05 11:36:02 +02:00 committed by Jérémy Lecour
parent 88899fb0fe
commit cf95909f0b
2 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
* bkctld: Replace xargs with a simple loop
### Deprecated
### Removed

8
bkctld
View File

@ -76,7 +76,9 @@ case "${subcommand}" in
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall" | "upgrade-config")
jail_name="${2:-}"
if [ "${jail_name}" = "all" ]; then
"${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 --max-procs=0 "${LIBDIR}/bkctld-${subcommand}"
for jail in $("${LIBDIR}/bkctld-list"); do
"${LIBDIR}/bkctld-${subcommand}" "${jail}"
done
elif [ -z "${jail_name}" ]; then
"${LIBDIR}/bkctld-help"
exit 1
@ -87,7 +89,9 @@ case "${subcommand}" in
"status")
jail_name="${2:-}"
if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then
"${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 "${LIBDIR}/bkctld-${subcommand}"
for jail in $("${LIBDIR}/bkctld-list"); do
"${LIBDIR}/bkctld-${subcommand}" "${jail}"
done
else
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
fi