I have 100 servers and i need to login to them with ssh from central server using script: i tried below with this i should get the version redirected to the file which will be stored at central server.
#!/bin/bash
CMD='java -version'
while read line
do
ssh -n user@"$line" $CMD >> /pathforoutputfile/outputjava.txt
done < /pathforhosts/hosts.txt
But I am not getting output generated in file /pathforoutputfile/outputjava.txt
ansible
for server orchestration. see https://stackoverflow.com/questions/30388361/ansible-command-to-check-the-java-version-in-different-servers – Michael D. May 27 '19 at 16:51set -x
. – jordanm May 27 '19 at 16:58