Today I found an issue for one of my script, the script is get a list server from server A and remote ssh Server B for doing something, the issues is that even though I have multiple servers but the ssh would stop after the first one, my original code is like this:
cat server_list|while read Server
ssh -l oraware B "echo $server_name"
done
After some digging, the issues is the read will treat standard input as it's input.
To make it works, just add the red part to the ssh
cat server_list|while read Server
ssh -l oraware B "echo $server_name" < /dev/null
done
No comments:
Post a Comment