Files
Server-scripts/raspberry/scripts/ping.sh
T

17 lines
320 B
Bash
Raw Normal View History

2026-04-14 23:55:26 +02:00
#!/bin/bash
args=("$@")
norm="\e[0m"
blue="\e[34m"
red="\e[31m"
printf "%s \t[$blue UP $norm]\n" "$(hostname)"
for ((i=0; i < $#; i++))
{
ping -c 2 -W 1 -q ${args[$i]} 1>/dev/null
if [ $? -eq 0 ]; then
printf "%s \t[$blue UP $norm]\n" "${args[$i]}"
else
printf "%s \t[$red DOWN $norm]\n" "${args[$i]}"
fi
}