Originally Posted by MOFH
Ok I know this question has been asked before as I've read through the threads and I've also done this before but can't get it to work now
Simple question really:
log onto a list of nodes say node 2-5 see who's on and then leave
I have something like:
for u 2 3 4 5 ; do
ssh -n node$u (also tried rsh -n and just rsh and ssh)
logout (or exit)
The problem is it logs onto the nodes but doesn't logoff. Is there something fundamentally wrong with this bash script?
My guess would be that you're starting a new shell on the remote box, while the commands are in the shell-script on the local box. You initiate the new shell fine, but then it sits there.
Try putting the command on the SSH line, like:
ssh -n node$u "insert command name here"
That'll just attach and run that command, without opening a new shell on the remote end. You might also want to look at the "fanout" program (Google can show you the way...), or write a script using "expect", so it'll enter the commands as if you were typing them.