summaryrefslogtreecommitdiff
path: root/update_hosts
diff options
context:
space:
mode:
authorgrothedev <grothedev@gmail.com>2021-12-28 11:19:03 -0500
committergrothedev <grothedev@gmail.com>2021-12-28 11:19:03 -0500
commiteb84970e2d2a3e1a0d0f309ee5438d1d4243bb4f (patch)
tree31d484dcc4a8189dd4851447ce0a1692d2fc0a12 /update_hosts
parent5fa7f35a6b52301cc02c85e8383c9e61e379d351 (diff)
fixed host update script and added ability to pull pdfs from website
Diffstat (limited to 'update_hosts')
-rwxr-xr-xupdate_hosts7
1 files changed, 4 insertions, 3 deletions
diff --git a/update_hosts b/update_hosts
index 745eb68..0b3cc5a 100755
--- a/update_hosts
+++ b/update_hosts
@@ -8,9 +8,10 @@ localcheck=`nmap -sn 192.168.1.0/24 | grep debian`
if [[ $localcheck ]]; then
hb_ip=`echo $localcheck | sed 's/.*(\(.*\))/\1/g'`
else
- hb_ip=`ping grothe.ddns.net -c 1 | sed 's/bytes from.*(\(.*\)).*/\1/g'`
+ hb_ip=`ping grothe.ddns.net -c 1 | grep PING | awk '{print $3}' | sed 's/(\|)//g'`
fi
-sed -i 's/'${hb_ip}'.*//g'
-echo '${hb_ip} hb' >> /etc/hosts
+#sed -i 's/'${hb_ip}'.*//g' /etc/hosts
+sed -i 's/.*hb//g' /etc/hosts
+echo "${hb_ip} hb" >> /etc/hosts