From 0bb884708745a708b35a3185afc6ad99f20c1838 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 31 Jan 2020 17:25:38 +0100 Subject: [PATCH] utils/filtron.sh: add option to debug filtron requests Signed-off-by: Markus Heiser --- utils/filtron.sh | 74 +++++++++++++++++++++++++- utils/templates/etc/filtron/rules.json | 12 ----- 2 files changed, 73 insertions(+), 13 deletions(-) diff --git a/utils/filtron.sh b/utils/filtron.sh index 9559902dd..528bedff2 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -61,6 +61,7 @@ usage: $(basename "$0") activate [service] $(basename "$0") deactivate [service] $(basename "$0") inspect [service] + $(basename "$0") option [debug-on|debug-off] $(basename "$0") apache [install|remove] @@ -77,6 +78,8 @@ deactivate service stop and deactivate service daemon (systemd unit) inspect service show service status and log +option + set one of the available options apache install: apache site with a reverse proxy (ProxyPass) remove: apache site ${APACHE_FILTRON_SITE} @@ -155,6 +158,13 @@ main() { remove) remove_apache_site ;; *) usage "$_usage"; exit 42;; esac ;; + option) + sudo_or_exit + case $2 in + debug-on) echo; enable_debug ;; + debug-off) echo; disable_debug ;; + *) usage "$_usage"; exit 42;; + esac ;; *) usage "ERROR: unknown or missing command $1"; exit 42;; esac @@ -378,7 +388,12 @@ EOF err_msg "Public service at ${PUBLIC_URL} is not available!" fi - wait_key + local _debug_on + if ask_yn "Enable filtron debug mode?"; then + enable_debug + _debug_on=1 + fi + echo systemctl --no-pager -l status filtron.service echo @@ -388,9 +403,66 @@ EOF trap break 2 journalctl -f -u filtron done + + if [[ $_debug_on == 1 ]]; then + disable_debug + fi return 0 } + +enable_debug() { + info_msg "try to enable debug mode ..." + python <