Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Bash script Ping check utility to do continuous check and result save

echo
echo -e "Enter host ip: c"
read -r usrip
echo -e "Enter result file name: c"
read -r resdump
echo
touch /tmp/$resdump
echo "" > /tmp/$resdump
echo "========== Detail result for $usrip in /tmp/$resdump =========="
echo

until ping $usrip -c 3 >> /tmp/$resdump
do
        echo "Host $usrip is down."
        sleep 1
done
echo
echo "Host $usrip is up."
echo
 
PREVIOUS NEXT
Tagged: #Bash #script #Ping #check #utility #continuous #check #result #save
ADD COMMENT
Topic
Name
3+9 =