Procházet zdrojové kódy

setting up an exit bypass

Daniel Gibbs před 10 roky
rodič
revize
cf95c40de8

+ 1 - 0
lgsm/functions/command_debug.sh

@@ -53,6 +53,7 @@ done
 fn_print_info_nl "Stopping any running servers"
 fn_script_log_info "Stopping any running servers"
 sleep 1
+exitbypass=1
 command_stop.sh
 fn_print_dots "Starting debug"
 fn_script_log_info "Starting debug"

+ 1 - 1
lgsm/functions/command_restart.sh

@@ -9,7 +9,7 @@ lgsm_version="210516"
 local modulename="Restarting"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
-restart=1
+exitbypass=1
 info_config.sh
 command_stop.sh
 command_start.sh

+ 16 - 8
lgsm/functions/core_exit.sh

@@ -6,22 +6,30 @@ lgsm_version="210516"
 
 # Description: handles exiting of LGSM by running and reporting an exit code.
 
+fn_exit_dev_debug(){
+	if [ -f "${rootdir}/.dev-debug" ]; then
+		echo "${function_selfname} exiting with code: ${exitcode}"
+	fi
+}
+
 if [ -n "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
 	if [ "${exitcode}" == "1" ]; then
-		fn_script_log_fatal "Exiting with code: ${exitcode}"
+		fn_script_log_fatal "${function_selfname} exiting with code: ${exitcode}"
 	elif [ "${exitcode}" == "2" ]; then
-		fn_script_log_error "Exiting with code: ${exitcode}"
+		fn_script_log_error "${function_selfname} exiting with code: ${exitcode}"
 	elif [ "${exitcode}" == "3" ]; then
-		fn_script_log_warn "Exiting with code: ${exitcode}"
+		fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}"
 	else
-		fn_script_log_warn "Exiting with code: ${exitcode}"
+		fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}"
 	fi
+	fn_exit_dev_debug
 	exit ${exitcode}
+elif [ -n "${exitbypass}" ]; then
+	unset exitbypass
 else
+	fn_script_log_pass "${function_selfname} exiting with code: ${exitcode}"
 	exitcode=0
+	fn_exit_dev_debug
+	exit ${exitcode}
 fi
 
-if [ -f "${rootdir}/.dev-debug" ]; then
-	sleep 0.5
-	echo "${function_selfname} exiting with code: ${exitcode}"
-fi