checks needs to run before jail starts

This commit is contained in:
Christer Edwards
2020-02-04 14:52:19 -07:00
parent b1e44e39ce
commit 11d7524446
+6 -2
View File
@@ -64,13 +64,17 @@ for _jail in ${JAILS}; do
## test if not running ## test if not running
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}" ## warn if matching configured (but not online) ip4.addr
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g') ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
if ifconfig | grep -w "$ip" >/dev/null; then if ifconfig | grep -w "$ip" >/dev/null; then
echo -e "${COLOR_RED}Error: IP address ($ip) already in use.${COLOR_RESET}" echo -e "${COLOR_RED}Error: IP address ($ip) already in use.${COLOR_RESET}"
exit 1 exit 1
fi fi
## start the container
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}
## add rctl limits ## add rctl limits
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then
while read _limits; do while read _limits; do