Compare commits

...

2 Commits

Author SHA1 Message Date
oleg 1fe5edcd74 build script fix 2024-12-03 12:37:48 -05:00
oleg 8510226599 host checking improving 2024-12-03 12:32:40 -05:00
3 changed files with 17 additions and 9 deletions
+4 -4
View File
@@ -3,11 +3,11 @@
# ---------------- Settings # ---------------- Settings
declare -A git_repo_arr declare -A git_repo_arr
git_repo_arr[cvttpy]=git@cloud21.cvtt.vpn:/opt/store/git/cvttpy.git git_repo_arr[cvttpy]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/cvttpy.git
git_repo_arr[ops]=git@cloud21.cvtt.vpn:/opt/store/git/ops.git git_repo_arr[ops]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/ops.git
git_repo_arr[research]=git@cloud21.cvtt.vpn:/opt/store/git/research.git git_repo_arr[research]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/research.git
git_repo_arr[cvtt-rust]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/cvtt-rust.git git_repo_arr[cvtt-rust]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/cvtt-rust.git
git_repo_arr[docker_dev]=git@cloud21.cvtt.vpn:/opt/store/git/docker_dev.git git_repo_arr[docker_dev]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/docker_dev.git
dist_root=/home/cvttdist/software/cvtt2 dist_root=/home/cvttdist/software/cvtt2
dist_user=cvttdist dist_user=cvttdist
+1 -1
View File
@@ -1 +1 @@
1.8.7,prepare equity simulation data 1.8.8.F1,build script fix, host checking improving
+12 -4
View File
@@ -5,7 +5,8 @@
# "users": ["oleg"], # "users": ["oleg"],
# "type": "cloud", # "type": "cloud",
# "ssh_port": 7822, # "ssh_port": 7822,
# # "to_check": "No" # # "to_check": false
# "timeout_sec": 5
# }, # },
RootDir="${HOME}/prod" RootDir="${HOME}/prod"
@@ -46,6 +47,7 @@ function host_alert() {
User=oleg User=oleg
Hosts=() Hosts=()
DEFAULT_SSH_PORT=22 DEFAULT_SSH_PORT=22
DEFAULT_TIMEOUT=5
Domains=("${Domains[@]}" "$(get_domains)") Domains=("${Domains[@]}" "$(get_domains)")
for Domain in ${Domains[@]} ; do for Domain in ${Domains[@]} ; do
@@ -56,16 +58,22 @@ for Host in ${Hosts[@]} ; do
host=$(echo $Host | cut -d'.' -f1) host=$(echo $Host | cut -d'.' -f1)
Domain=$(echo $Host | cut -d'.' -f2-) Domain=$(echo $Host | cut -d'.' -f2-)
ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // "Yes"') # ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // "Yes"')
if [ "${ToCheck^^}" == "NO" ]; then # 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 continue
fi fi
PortSSH=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].ssh_port // '"$DEFAULT_SSH_PORT"'') 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"'')
echo "Checking host: $Host on port $PortSSH" echo "Checking host: $Host on port $PortSSH"
# Use nc to check if the specified port is open # Use nc to check if the specified port is open
if ! nc -z -w5 "$Host" "$PortSSH"; then if ! nc -z -w ${Timeout} "$Host" "$PortSSH"; then
echo "Host $Host is not available on port $PortSSH" echo "Host $Host is not available on port $PortSSH"
host_alert "Host $Host is not available on port $PortSSH" host_alert "Host $Host is not available on port $PortSSH"
fi fi