Fix to match exact container name, add missing quotes

This commit is contained in:
Jose
2019-12-27 13:15:58 -04:00
parent de1590d709
commit 0c78ebae88
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -54,16 +54,16 @@ if [ "${TARGET}" = 'ALL' ]; then
JAILS=$(bastille list jails)
fi
if [ "${TARGET}" != 'ALL' ]; then
JAILS=$(bastille list jails | grep -w "${TARGET}")
JAILS=$(bastille list jails | awk "/^${TARGET}$/")
fi
for _jail in ${JAILS}; do
## test if running
if [ $(jls name | grep -w ${_jail}) ]; then
if [ "$(jls name | awk "/^${_jail}$/")" ]; then
echo -e "${COLOR_RED}[${_jail}]: Already started.${COLOR_RESET}"
## test if not running
elif [ ! $(jls name | grep -w ${_jail}) ]; then
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}