From: Roland Häder Date: Sun, 21 Jul 2024 10:40:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b5593271b0494b8045fce3a785416df922641e84;p=fba.git Continued: - added 3rd parameter for handling e.g. --force to fba.py or any other parameter fba.py handles - more "debug" lines added --- 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