network related script

script that pings hosts given as arguments to check reachability
This commit is contained in:
turbine 2025-11-20 04:52:18 +01:00
parent 968b5836f1
commit d4a4bcc185

16
wgtest Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env sh
USAGE="usage : wgtest <IP address> ..."
if [ $# -eq 0 ]; then
echo "$USAGE"
return
fi
for host in $@; do
if ping -c 1 "$host" >/dev/null 2>/dev/null ; then
echo "$host : REACHABLE";
else
echo "$host : UNREACHABLE";
fi
done