Hi,
First I hope this is the right list for asking this kind of question.

I would like to have a ssh connection just for port forwarding. So I would like
to stop it when I don't need it anymore (for a vnc connexion). 

I though I can run a command that is killed when I want, so that it ends the 
port-forwarding. For example :

$ssh -f -L port:host:port host fake_command

then, I can do:

$ssh host kill_fake_command 

that stops the fake_command and terminate the port forwarding. I tried to wait
for a process to terminate, a process with a known pid, 

$ssh host 'launch'

launch puts its pid in launch.pid

$ pid_to_wait=cat launch.pid
$ssh -f -L port:host:port host wait $pid_to_wait

but bash says:
bash: wait: pid 3839 is not a child of this shell

Have I missed something ? Is there a correct way to do this ?
Thanks for your attention.

Pat

Reply via email to