Skip to content

Perintah while true

July 21, 2007

#!/bin/bash
NET=`echo $1 | cut -f1,2,3 -d “.”`
DARI=`echo $1 | cut -f4 -d “.”`
SAMPAI=`echo $2 | cut -f4 -d “.”`
while true ;
do
if [ -z $1 ];
then
echo -e “33[46m cara pakai ./network.sh DARI_IP_INI SAMPAI_IP_INI 33[0m”
echo “contoh :”
echo -e “33[36m ./network.sh 192.168.1.1 192.168.1.7 33[0m”
break
elif [ $DARI -le $SAMPAI ];
then
if [ $USER = “root” ];
then
echo $USER
arping -c 1 $NET.$DARI |  grep ‘Received’ > /dev/null
fi
ping -c 1 $NET.$DARI    | grep ‘1 received’ > /dev/null
if [ $? = 0 ];
then

echo -e “33[35m jaringan ip $NET.$DARI STATUS = 33[42m33[5mhidup33[0m”
else
echo -e “33[31m jaringan ip $NET.$DARI STATUS = 33[43m33[5m mati 33[0m”
fi
DARI=$[DARI+1]
else
break
fi
done

From → Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: