[Bug 1473] Add option to save PID of a backgrounded ssh process
bugzilla-daemon at bugzilla.mindrot.org
bugzilla-daemon at bugzilla.mindrot.org
Wed Dec 23 06:48:08 EST 2009
https://bugzilla.mindrot.org/show_bug.cgi?id=1473
Tom Anderson <twic at urchin.earth.li> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |twic at urchin.earth.li
--- Comment #5 from Tom Anderson <twic at urchin.earth.li> 2009-12-23 06:48:06 EST ---
@Damien: The ControlMaster feature is very cool, but you can't
(currently) port-forward with the slaves, so if you're trying to set up
multiple port forwardings, it doesn't help.
@Darren: Things along this line (including ssh ... & ; echo $!) work in
many cases, but crucially, don't work with -f. -f is particularly
useful because ssh remains in the foreground until it has completed
authentication, so in a script, you can rely on a connection having
been made once it returns.
What i'd like to be able to do is to write scripts like:
echo "Starting port forwarding of A"
<SOME SSH COMMAND>
echo "Starting port forwarding of B"
<SOME SSH COMMAND>
echo "Doing lots of things using forwarded port ..."
<SOME COMMAND TO CLOSE ALL CONNECTIONS>
Whether this is using pid/kill or the ControlMaster mechanism.
I think i have an idea - mktemp a directory, then start several
independent control master connections, one for each forwarded port,
with control paths mktemp'd (or otherwise) in that directory, running
with -f. To shut them down, for-loop over the files in the directory
and do -O exit to close the connections. It's anything but pretty, but
it should work (a classic shell script, then!).
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
More information about the openssh-bugs
mailing list