Thanks for that Larry,

the simple script below has worked in testing so I'll tidy it up and stick it 
in my ip-up/ip-down scripts to see how it goes.

Gary

#!/usr/bin/perl -w

$file='/var/lock/sshport';
unlink $file||warn "cannot delete '$file': $!\n";
open(FOUT,"|ssh -L 110:stan:110 stan")|| die "cannot open pipe: $!\n";
while ( ! -f $file ) {
 sleep 5;
}
close(FOUT);


On Wednesday 19 Mar 2003 5:48 pm, Larry Brown wrote:
> I would think you could write a small perl script that would launch it and
> record the pid where it could be used to kill it on shutdown.  I use a perl
> script to launch sftp all the time and it works fine in the background.  My
> script closes the connection and ends but yours could remain in memory
> until killed.  I have not done this, but I would think it would work just
> fine this way.
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Gary Stainburn
> Sent: Wednesday, March 19, 2003 11:38 AM
> To: [EMAIL PROTECTED]
> Subject: Port Forwarding via SSH
>
> Hi folks,
>
> I'm trying to set up a port forward using SSH so that I can collect my
> emails
> from home through the company firewall (it's okay, I'm the sysadmin so I
> won't be treading on any toes.
>
> From the man page and various googles I've come up with:
>
> ssh -L 110:stan:110 stan
>
> which opens up a terminal session to stan and also sets up the port
> forward, so that if I then do
>
> telnet 127.0.0.1 110
>
> I get connected to the pop server on stan.
>
> What I need to know is how can I do this without ssh opening up the
> terminal session?  The reason being that I want to start the ssh port
> forward as part of my ip-up script and kill it as part of my ip-down
> script.
>
> When I tried putting it in the background by sticking an ampersand on the
> end,
> it stopped until I 'fg' ed it.

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to