[Discuss] Ideas for solving a remove backup quandary
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Fri May 9 15:13:45 PDT 2008
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
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
__________________________
More information about the Discuss
mailing list