From b5593271b0494b8045fce3a785416df922641e84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 21 Jul 2024 12:40:14 +0200 Subject: [PATCH] Continued: - added 3rd parameter for handling e.g. --force to fba.py or any other parameter fba.py handles - more "debug" lines added --- nodeinfo.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/nodeinfo.sh b/nodeinfo.sh index 9712a29..86ab79c 100755 --- a/nodeinfo.sh +++ b/nodeinfo.sh @@ -3,10 +3,14 @@ MODE="" DOMAIN_LIST="" SOFTWARE_LIST="" +TEMP_FILE="${TMP}/domains.txt" if [ "$1" = "--help" ] then - echo "Usage: $0 [file|--software|--nodeinfo|--generator|--timeout|--same]" + echo "Usage: $0 [file|--software|--nodeinfo|--generator|--timeout|--same] [--any|--remove]" + echo "" + echo "--any : Any parameter that is being handled to fba.py, e.g. --force is common." + echo "--remove : Removes each successfully handled entry from provided file (if provided)." exit 255 elif [ -n "$1" -a -f "$1" ] then @@ -48,12 +52,30 @@ then echo "$0: DOMAIN='${DOMAIN}'" if [ -n "$1" -a -z "${MODE}" ] then + echo "$0: Parameter 1='$1' ..." ./fba.py update_nodeinfo --domain="${DOMAIN}" "$1" - elif [ -n "$2" ] + STATUS="$?" + elif [ -n "$2" -a "$2" != "--remove" ] then + echo "$0: Parameter 2='$2' ..." ./fba.py update_nodeinfo --domain="${DOMAIN}" "$2" + STATUS="$?" + elif [ "$2" = "--remove" -a -n "$3" ] + then + echo "$0: Parameter 3='$3' ..." + ./fba.py update_nodeinfo --domain="${DOMAIN}" "$3" + STATUS="$?" else + echo "$0: No special parameter ..." ./fba.py update_nodeinfo --domain="${DOMAIN}" + STATUS="$?" + fi + echo "$0: STATUS='${STATUS}'" + if [ "${STATUS}" = "0" -a "$2" = "--remove" -a "${MODE}" = "file" ] + then + echo "$0: Removing DOMAIN='${DOMAIN}' from file '$1' ..." + grep -v "${DOMAIN}" "$1" > "${TEMP_FILE}" + mv -v "${TEMP_FILE}" "$1" fi done elif [ -n "${SOFTWARE_LIST}" ] @@ -64,9 +86,12 @@ then if [ -n "$2" ] then ./fba.py update_nodeinfo --software="${SOFTWARE}" "$2" + STATUS="$?" else ./fba.py update_nodeinfo --software="${SOFTWARE}" + STATUS="$?" fi + echo "$0: STATUS='${STATUS}'" done fi -- 2.39.5