<div dir="ltr">If you skip -f and use & to put it into the background I think you can capture the pid in $!<div><br></div><div><span style="font-size:12.8px">ssh -NT -L 6111:</span><a href="http://remote.server.org:8080/" target="_blank" style="font-size:12.8px">remote.server.org:8080</a><span style="font-size:12.8px"> -L 6112:</span><a href="http://remote.server.org:8080/" target="_blank" style="font-size:12.8px">remote.server.org:8080</a><span style="font-size:12.8px"> </span><a href="mailto:me@tunnel.server.org" target="_blank" style="font-size:12.8px">me@tunnel.server.org</a> & PIDOF=$!<br></div><div><br></div><div>Jonathan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 2:38 PM, Snyder, Alexander <span dir="ltr"><<a href="mailto:alex@misteralexander.com" target="_blank">alex@misteralexander.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hello!</div><div><br></div><div>I have written a script that establishes an SSH Tunnel and does Port Forwarding from a local CYGWIN Shell ....<br></div><div><br></div><div>When I try to kill the tunnel by the PID, I get nothing ...</div><div><br></div><div>Does anyone know how CYGWIN handles PIDs in a local Shell?</div><div><br></div><div>ssh -NTf -L 6111:<a href="http://remote.server.org:8080" target="_blank">remote.server.org:8080</a> -L 6112:<a href="http://remote.server.org:8080" target="_blank">remote.server.org:8080</a> <a href="mailto:me@tunnel.server.org" target="_blank">me@tunnel.server.org</a><br></div><div>PIDOF=$!</div><div><div>echo -e "Local Port 6111 is now resolving content from \"<a href="http://remote.server.org:8080" target="_blank">remote.server.org:8080</a>\""</div><div>echo -e "Local Port 6112 is now resolving content from \"<a href="http://remote.server.org:8080" target="_blank">remote.server.org:8080</a>\""<br></div><div>echo -e ""</div><div>echo -e "Port Forwarding ${red_back}${yellow_text}Active${norm_text}${norm_back}:"</div><div> while true</div><div> do</div><div> echo -e "Press Any Key to ${red_text}STOP${norm_text} Port Forwarding ..."</div><div> read kill</div><div> case $kill in</div><div> *) kill $PIDOF ;;</div><div> esac</div><div> done</div><div> ;;</div><div>esac</div></div><div><br></div><div>I'm just getting an empty variable (kill has nothing to kill) .... since this is just a local shell and not a full fledged system, I was wondering if anyone knew how CYGWIN handles PIDs.</div></div><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">--<br>Thanks,<br>--:: Alexander J. Snyder ::--<br>--:: <a href="http://thisguyshouldworkfor.us" target="_blank">ThisGuyShouldWorkFor.Us</a> ::--<br>--:: "Never trust a computer you can't throw out a window. --Steve Wozniak" ::--<br>--</div></div></div></div></div></div></div>
</div>
<br>---------------------------------------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org">PLUG-discuss@lists.phxlinux.org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" rel="noreferrer" target="_blank">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br></blockquote></div><br></div>