switch to using hping3 for connectivity testing/ip resolution

This commit is contained in:
Cisien
2018-11-03 16:30:46 -07:00
parent 5a87d365cf
commit fdbc659527
6 changed files with 18 additions and 12 deletions

View File

@@ -26,7 +26,7 @@ function fix_errors_in_mounted_files () {
function archive_is_reachable () {
local reachable=true
ping -q -w 1 -c 1 "$ARCHIVE_HOST_NAME" > /dev/null 2>&1 || reachable=false
hping3 -c 1 -S -p 445 "$ARCHIVE_HOST_NAME" > /dev/null 2>&1 || reachable=false
if [ "$reachable" = false ]
then
false

View File

@@ -3,7 +3,7 @@
function check_archive_server_reachable () {
echo "Verifying that the archive server $archiveserver is reachable..."
local serverunreachable=false
ping -c 1 -w 1 "$archiveserver" 1>/dev/null 2>&1 || serverunreachable=true
hping3 -c 1 -S -p 445 "$archiveserver" 1>/dev/null 2>&1 || serverunreachable=true
if [ "$serverunreachable" = true ]
then

View File

@@ -1,3 +1,3 @@
#!/bin/bash -eu
echo "$(ping -c 1 -w 1 $1 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')"
echo "$(hping3 -c 1 -S -p 445 -n $1 2>/dev/null | head -n 1 | grep -o -e "\W\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d ' )')"