]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 21 Jul 2024 10:40:14 +0000 (12:40 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 21 Jul 2024 10:41:36 +0000 (12:41 +0200)
- added 3rd parameter for handling e.g. --force to fba.py or any other parameter
  fba.py handles
- more "debug" lines added

nodeinfo.sh

index 9712a294379814b3c78e626843a80e9985705ad9..86ab79cac3c386bd6be672a453bc2d79efaceb55 100755 (executable)
@@ -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