[Techtalk] Shell script not working for a remote ssh login - manually entering commands work fine

jennyw jennyw at dangerousideas.com
Wed Mar 12 18:35:58 EST 2003


You might consider as an alternative using rsync ...

rsync -v -a -e ssh user at host:/directory .

Would copy all your files to the current directory over ssh.  Rsync has
the advantage of copying only changed files, which can make things much
quicker.

Of course, you can get really fancy with rsync and ssh.  Here's an 
article (although I haven't followed it I've heard others have had luck 
with it): 

http://www.linuxmafia.com/~rick/linux-info/ssh-publickey-process

Jen

On Wed, Mar 12, 2003 at 12:54:46PM -0800, Lucky Lady wrote:
> Hi,
> 
> I just set up a remote ssh logon without using a
> password. All works fine. Basically, I want to be able
> to use a shell script to copy a tarball from the
> remote PC to my backup PC. When I enter these commands
> in manually, everything works.
> 
> 1. su backup 
> 
> 2. scp
> support.mycompany.com:/home/backup/support.tar.gz
> /home/backup/cur_support.tar.gz
> 
> 3. exit 
> 
> This takes a few minutes as the tarball is 12 mb.
> 
> However, when I put these commands in a shell script
> and run it, the tarball is not copied and I remain on
> the remote pc. Here is my shell script:
> 
> #!/bin/sh
> 
> su backup
> 
> scp support.mycompany.com:/home/backup/support.tar.gz
> /home/backup/cur_support.tar.gz
> 
> exit
> 
> # End of script
> 
> What am I missing?
> 
> TIA
> 
> DaLy
> 
> 
> 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
> 
> 


More information about the Techtalk mailing list