Skip to content

Commit

Permalink
Merge pull request #303 from yerrysherry/cmdbug
Browse files Browse the repository at this point in the history
bastille cmd exit code not respected #272
  • Loading branch information
cedwards committed Jul 31, 2021
2 parents c02a873 + 5c89ac5 commit 7f1dbc1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions usr/local/share/bastille/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,28 @@ if [ $# -eq 0 ]; then
usage
fi

COUNT=0
RETURN=0

for _jail in ${JAILS}; do
COUNT=$(($COUNT+1))
info "[${_jail}]:"
jexec -l -U root "${_jail}" "$@"
ERROR_CODE=$?
info "[${_jail}]: ${ERROR_CODE}"

if [ "$COUNT" -eq 1 ]; then
RETURN=$ERROR_CODE
else
RETURN=$(($RETURN+$ERROR_CODE))
fi

echo
done

# Check when a command is executed in all running jails. (bastille cmd ALL ...)
if [ "$COUNT" -gt 1 ] && [ "$RETURN" -gt 0 ]; then
RETURN=1
fi

return "$RETURN"

0 comments on commit 7f1dbc1

Please sign in to comment.