Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b4552a9

Browse files
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 "$serveris up"
1515
else
16-
echo "$i Host is Up"
16+
echo "$serveris Down"
1717
fi
1818
done
1919
# END #

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /