On 17/11/2018 21.59, Florian Gleixner wrote:
On 16.11.18 23:22, Carlos E. R. wrote:
Hi,
on my laptop I use a script that launches several lines like this to connect to my home server:
exec ssh -L 127.0.0.1:60000:192.168.X.Y:80 -N user@host &
It works fine. The problem is killing that connection. What I do is "killall ssh", but perhaps there is another way I have not thought about? I mean, kill that ssh session and not another?
Add the line
echo $!
to your script directy after that line. This is the PID of ssh you can kill later.
Oh! Of course :-) I had forgotten about that. The PID can be saved to a file, and then another script can be used to kill them, without tying any terminal or process. Thanks, all :-) Launching a terminal for each one was the idea I had thought about but discarded, too many terminals already. The symlink idea is interesting, very easy to implement. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar)