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:
1. DEVOPS : https://www.amazon.com/dp/B07LBMCPNY
Comments
Post a Comment