DEVOPS-PRACTICAL-PROBLEM-3

Practical Problem:Suppose you have multiple number of files which exit in multiple servers and you want  to know the size of all the file  in minimum time. How will you overcome with this problem ?

Solution:

#!/bin/bash
for i in $(cat hostname.txt)
do
echo "****START****"
done
for j in $(cat file-name.txt)
do 
ssh $i du -sh $j
done
echo "*****END*****"

Here we are using i variable to store the hostname and j variable to store file name.du command is use to get the size of the file in human readable format.

Output:

4.0K /home/anil/hello.txt

For more practical Problems Please support us by Purchasing the below practical books:



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)