We use cookies to ensure you get the best experience on our website.
#!/bin/bash
# Set array of servers
servers=("server1" "server2" "server3")
# Set timeout
timeout=5
# Function to check ping for a server
check_ping() {
host=$1
ping -c 1 -W $timeout $host > /dev/null
if [ $? -eq 0 ]; then
echo "$host is responding to ping."
else
echo "$host is not responding to ping."
fi
}
# Iterate over the servers array and check ping
for server in "${servers[@]}"; do
check_ping "$server"
done
Cześć Podróżniku!
Ta strona ma nie być typowym poradnikiem w IT, Głównym jej cel to zapisanie krótkich notatek, które mogą się przydać w codziennym życiu podczas korzystania/konfiguracji różnych urządzeń np. Ustawienia DHCP na Routerze Cisco, Ustawieniu Karty sieciowej na Linuxie itp.
Wszelkie prawa zastrzeżone
Dodaj komentarz