Commit ffcb89d6 authored by laila.alabdullah's avatar laila.alabdullah

add check.sh

parent 8c2379ee
#!/bin/bash
cp /dev/null text.txt
echo "$1" >> text.txt
num1=$( cut -d '-' -f 1 text.txt | cut -d '.' -f 4 )
num2=$( cut -d '-' -f 2 text.txt | cut -d '.' -f 4 )
if [ "$num1" -le "$num2" ] && [ "$num2" -le 256 ] && [ "$num1" -ge 1 ] ; then
for n in $(seq $num1 $num2) ; do
host=192.168.0.$n
ping -c $host &> /dev/null
if [ $? = 0 ] ; then
echo "$host is UP"
else
echo "$host is DOWN"
fi
done
else
echo "ERROR"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment