I have simple script to check for uptime of bunch of hosts. But ssh command is taking 'uptime' command also as a hostname and throwing error after first iteration.
while read line
do
echo "Turning off Monitoring for Host: $line"
monitoring_off
check_uptime $line
done < "$HOSTFILE"
check_uptime() {
ssh $1 'uptime'
}
Here is the output of my script execution:
*****************************
14:08:44 up 203 days, 2:34, 1 user, load average: 1.22, 1.11, 0.79
ssh: Could not resolve hostname uptime: nodename nor servname provided, or not known
Could you please me in locating my mistake in here