Bash-Practical-Problem-5
Practical Problem: Suppose you need to determine the up-time of the multiple servers.How will you overcome with this problem ?
Solution:
#!/bin/bash
for i in $(cat hostname.txt)
do
echo "*****START*****"
ssh $i uptime
echo "*****END******"
done
i variable is used to store the value from the hostname.txt file.uptime is a linux command which is used to display the uptime.
Python and Shell Scripting Tutorials: https://payhip.com/b/247HD
Comments
Post a Comment