I'm trying to automate a process with perl that will basically telnet into one system, "ssh -f -N" into two more and finally open a screen/tmux session and run sshuttle, then disconnect from screen/tmux.
If I am going to be running ssh with the "-f -N" options - is this best handled through Net::SSH::Expect, Net::Expect, system or exec?
I'm concerned with Net::SSH or Net::Expect as I'm not sure of a few things, first, how can I get Net::Expect/SSH to recognize that the SSH session is successful? That is to say, when I program Net::Expect and spawn the ssh session with those parameters, and subsequently login, there is no more output for 'expect' to see. I'd like to rely upon something other than the expect timeout.
Does that make sense? I'm not sure I'm phrasing my question clearly.
I'm also not sure how perl will behave if I spawn the ssh session that goes into the background. Will my perl program never exit? Waiting for the backgrounded SSH sessions to end?
It is because of this last question that I ask the additional questions of whether I should be considering the use of system or exec calls over Net::Expect
.