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

Popular posts from this blog

Python & Shell Scripting Real Time Course Book & Videos

Top Five Devops Technical Interview QA Books

Linux-Command Hands-On (DF)