Merge pull request #93 from cimryan/feature/hping3

Feature/hping3
This commit is contained in:
cimryan
2018-11-03 18:19:16 -07:00
committed by GitHub
9 changed files with 29 additions and 4 deletions

View File

@@ -1 +1,2 @@
dos2unix
dos2unix
hping3

View File

@@ -26,7 +26,9 @@ 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
/root/bin/archive-is-reachable.sh || reachable=false
if [ "$reachable" = false ]
then
false

View File

@@ -0,0 +1,5 @@
#!/bin/bash -eu
ARCHIVE_HOST_NAME="$1"
hping3 -c 1 -S -p 445 "$ARCHIVE_HOST_NAME" > /dev/null 2>&1

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
@@ -43,6 +43,13 @@ function check_archive_mountable () {
umount "$test_mount_location"
}
function install_required_packages () {
apt-get -y --force-yes install hping3
}
install_required_packages
ARCHIVE_SERVER_IP_ADDRESS="$( $INSTALL_DIR/lookup-ip-address.sh "$archiveserver" )"
check_archive_server_reachable

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 ' )')"

View File

@@ -0,0 +1,3 @@
#!/bin/bash -eu
ping -q -w 1 -c 1 8.8.8.8 > /dev/null 2>&1

View File

@@ -0,0 +1,5 @@
#!/bin/bash -eu
ARCHIVE_HOST_NAME="$1"
ping -q -w 1 -c 1 "$ARCHIVE_HOST_NAME" > /dev/null 2>&1

View File

@@ -122,6 +122,7 @@ function install_archive_scripts () {
get_script $install_path connect-archive.sh $archive_module
get_script $install_path disconnect-archive.sh $archive_module
get_script $install_path write-archive-configs-to.sh $archive_module
get_script $install_path archive-is-reachable.sh $archive_module
}

View File

@@ -15,6 +15,7 @@ apt-get -y --force-yes autoremove --purge
# Replace log management with busybox (use logread if needed)
echo "Installing ntp and busybox-syslogd..."
apt-get -y --force-yes install ntp busybox-syslogd; dpkg --purge rsyslog
echo "Configuring system..."
# Add fastboot, noswap and/or ro to end of /boot/cmdline.txt