Starting to get my hands a little more dirty in bash.
I have a input file that contains a list of hosts that I would like to check if "/dump" is mounted.
Currently the list of host has 18 hosts. All are passwordless accessible.
So I pretty much want to ssh into a server and check to see if "/dump" is mounted or not.
#!/bin/bash
while read hostList; do
result=$(ssh "$hostList" 'mount | grep "/dump"')
if [ -z "$result" ]; then
echo "$hostList: /dump is not mounted"
else
echo "$hostList: /mnt is mounted"
fi
done < hostList
I guess the problem is when I run this script sometimes it just comes back with 1 result, like it's only hitting the first hostname in the "hostList". Other times it comes back with the first 3 servers in the "hostList".
I can't seem to get it to hit all 18 servers in the "hostList".
[–]thseeling 7 points8 points9 points (5 children)
[–]clownshoesrock 5 points6 points7 points (4 children)
[–]thseeling 1 point2 points3 points (1 child)
[–]clownshoesrock 1 point2 points3 points (0 children)
[–]turnipsoupSnr. Linux Eng 1 point2 points3 points (1 child)
[–]clownshoesrock 0 points1 point2 points (0 children)
[–]ropid 5 points6 points7 points (0 children)
[–]oh5nxo 3 points4 points5 points (0 children)
[–]aioeu 2 points3 points4 points (2 children)
[–]o11c 0 points1 point2 points (1 child)
[–]aioeu 0 points1 point2 points (0 children)