Skip to content

Commit b4552a9

Browse files
authored
Update for-loop.sh
1 parent 11ec140 commit b4552a9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

for-loop.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
#Modified Date:
77
#Author: Ankam Ravi Kumar
88
# START #
9-
for i in `cat hostfile`
9+
for server in `cat /scripts/servers`
1010
do
11-
ping -c 1 $i > /tmp/pingresults
11+
ping -c 1 $server > /tmp/ping
1212
valid=`echo $?`
13-
if [ $valid -gt 1 ]; then
14-
echo "$i Host is not reachable"
13+
if [ $valid -eq 0 ]; then
14+
echo "$server is up"
1515
else
16-
echo "$i Host is Up"
16+
echo "$server is Down"
1717
fi
1818
done
1919
# END #

0 commit comments

Comments
 (0)