fix: no boolean for jq, it considers "false" as missing (null)
This commit is contained in:
parent
1fe5edcd74
commit
8b38ffa1af
@ -1 +1 @@
|
||||
1.8.8.F1,build script fix, host checking improving
|
||||
1.8.8.F2,no boolean for jq, it considers "false" as missing (null)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# "users": ["oleg"],
|
||||
# "type": "cloud",
|
||||
# "ssh_port": 7822,
|
||||
# # "to_check": false
|
||||
# # "to_check": "false"
|
||||
# "timeout_sec": 5
|
||||
# },
|
||||
|
||||
@ -48,6 +48,7 @@ User=oleg
|
||||
Hosts=()
|
||||
DEFAULT_SSH_PORT=22
|
||||
DEFAULT_TIMEOUT=5
|
||||
DEFAULT_TO_CHECK="true"
|
||||
Domains=("${Domains[@]}" "$(get_domains)")
|
||||
|
||||
for Domain in ${Domains[@]} ; do
|
||||
@ -58,18 +59,16 @@ for Host in ${Hosts[@]} ; do
|
||||
host=$(echo $Host | cut -d'.' -f1)
|
||||
Domain=$(echo $Host | cut -d'.' -f2-)
|
||||
|
||||
# ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // "Yes"')
|
||||
# if [ "${ToCheck^^}" == "NO" ]; then
|
||||
# continue
|
||||
# fi
|
||||
ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // true')
|
||||
if [ "$ToCheck" != "true" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
PortSSH=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].ssh_port // '"$DEFAULT_SSH_PORT"'')
|
||||
|
||||
Timeout=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].timeout_sec // '"$DEFAULT_TIMEOUT"'')
|
||||
|
||||
ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // '"$DEFAULT_TO_CHECK"'')
|
||||
to_check="${ToCheck}^^"
|
||||
if [ "${to_check}" != "TRUE" && "${to_check}" != "YES" && "${to_check}" != "Y" && "${to_check}" != "T" ]; then
|
||||
continue
|
||||
fi
|
||||
echo "Checking host: $Host on port $PortSSH"
|
||||
|
||||
# Use nc to check if the specified port is open
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user