[Discuss] Ideas for solving a remove backup quandary

Jeremy Kiffiak jeremy at truesolutions.ca
Tue May 13 16:02:38 PDT 2008


Chris,

Thanks again, that did the trick as far as setting up the tunnel.   
Next question:

How do I get the tunnel to delete itself after the script has  
completed successfully (or even not completed successfully)?

Jeremy


On 9-May-08, at 3:49 PM, Chris Hennessy wrote:

> You almost had it:)
> ssh -P 10022 -C -f -N -L  
> 127.0.0.1:10033:192.168.10.150:22<username>@remotegw1
>
> Your script actually didn't hang... the tunnel gets opened and stays  
> in the
> foreground.
>
> The -f in the command pushes it into the background.  You should be  
> able to
> run ssh against that 10033 port now.
>
> I tried the above on Mandriva 2008.1.
>
> have fun.
>
> Chris
>
> On Fri, May 9, 2008 at 3:25 PM, Jeremy Kiffiak <jeremy at truesolutions.ca 
> >
> wrote:
>
>> On 9-May-08, at 3:13 PM, Alan W. Irwin wrote:
>>
>> On 2008-05-09 14:46-0700 Jeremy Kiffiak wrote:
>>>
>>> I would like to do something similar with the new backup system as  
>>> well.
>>>> I thought to include an SSH tunnel at the beginning of my script  
>>>> but the
>>>> script hangs on that line.  The new (borked) script follows.  I  
>>>> have added a
>>>> few "echo" commands to try and see where the script was hanging.   
>>>> I am using
>>>> port 10022 for 2 reasons.  First it is non-standard so hopefully  
>>>> less
>>>> script-kiddy port scans will find it.  Second I have multiple  
>>>> boxes running
>>>> SSH on the REMOTE network.  On the remote router port 10022  
>>>> forwards to port
>>>> 22 on REMOTE-GW(IP1).
>>>>
>>>> #!/bin/sh
>>>> echo "Creating remote tunnel . . ."
>>>> ssh -p 10022 -C -N <username>@REMOTE1   \
>>>>       -L localhost:18128:10.10.8.128:22 &&
>>>> echo "Tunnel created successfully!"
>>>> echo "Starting backup process"
>>>> scp -p -P 18128 <username>@localhost:~/
>>>> echo "File(s) backed up!"
>>>>
>>>> How can I create a BASH script that initially creates an SSH  
>>>> tunnel that
>>>> rsync or scp can use to access the machine behind the gateway VM?
>>>>
>>>
>>> Here is some general advice about debugging scripts.
>>>
>>> To see all the commands that your bash script runs, use the -x  
>>> option,
>>> e.g.,
>>>
>>> bash -x ./dodgy_script.sh
>>>
>>
>>
>> Thank you Alan!  I did not know that.  Much appreciated.  :-)
>>
>> Jeremy
>>
>>
>>
>>
>>>
>>> Then if/when it hangs on some command, you should normally be able  
>>> to
>>> figure
>>> out what is wrong with the command simply by looking at it.  
>>> Alternatively
>>> if
>>> the command looks okay, you can run that exact command by hand to  
>>> verify
>>> the
>>> problem and continue the debugging directly without bash  
>>> obfuscating the
>>> problem.
>>>
>>> Alan
>>> __________________________
>>> Alan W. Irwin
>>>
>>> Astronomical research affiliation with Department of Physics and
>>> Astronomy,
>>> University of Victoria (astrowww.phys.uvic.ca).
>>>
>>> Programming affiliations with the FreeEOS equation-of-state  
>>> implementation
>>> for stellar interiors (freeeos.sf.net); PLplot scientific plotting
>>> software
>>> package (plplot.org); the libLASi project (unifont.org/lasi); the  
>>> Loads
>>> of
>>> Linux Links project (loll.sf.net); and the Linux Brochure Project
>>> (lbproject.sf.net).
>>> __________________________
>>>
>>> Linux-powered Science
>>> __________________________
>>> _______________________________________________
>>> Discuss mailing list
>>> Discuss at vlug.org
>>> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>>>
>>
>> _______________________________________________
>> Discuss mailing list
>> Discuss at vlug.org
>> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>>
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss



More information about the Discuss mailing list