mirror of
https://github.com/hackacad/bastille.git
synced 2026-01-06 04:34:19 +01:00
Add -b|--boot for start/stop/restart
This commit is contained in:
@@ -38,20 +38,26 @@ usage() {
|
||||
cat << EOF
|
||||
Options:
|
||||
|
||||
-v | --verbose Print every action on jail stop.
|
||||
-x | --debug Enable debug mode.
|
||||
-b | --boot Respect jail boot setting.
|
||||
-v | --verbose Print every action on jail stop.
|
||||
-x | --debug Enable debug mode.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Handle options.
|
||||
BOOT=0
|
||||
OPTION=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
-h|--help|help)
|
||||
usage
|
||||
;;
|
||||
-b|--boot)
|
||||
BOOT=1
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
OPTION="-v"
|
||||
shift
|
||||
@@ -63,6 +69,7 @@ while [ "$#" -gt 0 ]; do
|
||||
-*)
|
||||
for _opt in $(echo ${1} | sed 's/-//g' | fold -w1); do
|
||||
case ${_opt} in
|
||||
b) BOOT="1" ;;
|
||||
v) OPTION="-v" ;;
|
||||
x) enable_debug ;;
|
||||
*) error_exit "Unknown Option: \"${1}\"" ;;
|
||||
@@ -87,6 +94,14 @@ set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
# Continue if '-b|--boot' is set and 'boot=off'
|
||||
if [ "${BOOT}" -eq 1 ]; then
|
||||
BOOT_ENABLED="$(sysrc -f ${bastille_jailsdir}/${_jail}/boot.conf -n boot)"
|
||||
if [ "${BOOT_ENABLED}" = "off" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
info "[${_jail}]:"
|
||||
check_target_is_running "${_jail}" || error_continue "Jail is already stopped."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user