From 412c3f95e5392a182e8616313731f4553546913b Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Mon, 29 Jul 2019 13:31:36 -0800 Subject: Splitting restart into separate function and moving firewall dir check to start() and restart() --- src/bbfw.in | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/bbfw.in b/src/bbfw.in index 288b51a..f2a5f61 100755 --- a/src/bbfw.in +++ b/src/bbfw.in @@ -213,8 +213,25 @@ load() } +restart() { + if test ! -d "${FW_PREFIX}";then + echo "${PROGRAM_NAME}: ${FW_PREFIX}: firewall directory does not exist" 1>&2 + return 1 + fi + + stop + start +} + + # Function to start the network: start() { + # checks for firewall directory + if test ! -d "${FW_PREFIX}";then + echo "${PROGRAM_NAME}: ${FW_PREFIX}: firewall directory does not exist" 1>&2 + return 1 + fi + # run pre-hooks run_hook start ${FW_PREFIX}/global.d/pre-hook "running global pre-hook start ..." for FILE in $( find_appfile pre-hook );do @@ -337,10 +354,6 @@ FW_QUIET="$( config_option quiet "${FW_QUIET}" A-Z a-z )" # checks and normalizes options -if test ! -d "${FW_PREFIX}";then - echo "${PROGRAM_NAME}: ${FW_PREFIX}: firewall directory does not exist" 1>&2 - exit 1 -fi if test "x${FW_QUIET}" == "xno";then unset FW_QUIET elsif test "x${FW_QUIET}" != "xno";then @@ -377,8 +390,7 @@ case "$1" in 'restart') # "restart" restarts the network: echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER - stop 2>&1 | $LOGGER - start 2>&1 | $LOGGER + restart 2>&1 | $LOGGER ;; *) # The default is to bring up all configured interfaces: -- cgit v1.2.3