Copy a tar file from remote server
Sanjay katiyar
sanjay_katiyar1 at yahoo.co.in
Thu Mar 17 13:10:30 UTC 2005
As I supply password for user tomcat it connects to
the remote server and start showing $ prompt.
If I logged off from remote machine then it lost the
connection and next command is not executed.
Actully I even dont want to supply passward manully,
Is there any way to automate all these steps in a
script file?
1. connect to remote machine using ssh
2. tar some dir
3. copy that tar file to my local machine.
Thanks,
Sanjay
--- "Smith, Albert" <Albert.Smith at genexservices.com>
wrote:
> The reason it's failing is that you are trying to
> execute remote
> commands from a locally running script. Once you log
> off the remote
> machine the script will continue to execute
>
> #!/bin/sh
>
> Date=`date -I`
> ssh -l tomcate www.MyRemoteHost.net 'tar -cvf \
> /opt/tomcat4/MyDir/bk-$Date.tar
> /opt/tomcat4/webapps/MyApp'
>
> scp tomcat at www.MyRemoteHost.net:MyDir/bk-$Date.tar
> .
>
> Albert Smith
> Sr. Unix Systems Administrator
> HPCSA, RHCT
> Genex Services
> 440 E. Swedesford Rd.
> Wayne, PA 19087
> albert.smith at genexservices.com
> (610) 964-5154
>
>
> > -----Original Message-----
> > From: redhat-list-bounces at redhat.com
> > [mailto:redhat-list-bounces at redhat.com] On Behalf
> Of Sanjay katiyar
> > Sent: Thursday, March 17, 2005 5:58 AM
> > To: General Red Hat Linux discussion list
> > Subject: Copy a tar file from remote server
> >
> >
> > I am trying to connect a remote machine thruogh
> ssh and want
> > to tar one directory and copy the tar file in my
> local
> > machine. My script file looks like this
> > **************************
> > !/bin/sh
> >
> > Date=`date -I`
> >
> > ssh -l tomcat www.MyRemoteHost.net
> >
> > tar -cvf /opt/tomcat4/MyDir/bk-$Date.tar
> /opt/tomcat4/webapps/MyApp/
> >
> > scp tomcat at www.MyRemoteHost.net:MyDir/bk-$Date.tar
> .
> > **************************
> > When I run this script in my local machine it ask
> for
> > password of user tomcat, after supplying the
> password it
> > connects to the remote machine and does not
> execute the rest
> > of the commands.
> >
> > Can any one suggest the right script?
> >
> > Thanks in advance.
> >
> > Sanjay
> >
> >
>
______________________________________________________________
> > __________
> > Yahoo! India Matrimony: Find your life partner
> online Go to:
> > http://yahoo.shaadi.com/india-matrimony
> >
> > --
> > redhat-list mailing list
> > unsubscribe
>
mailto:redhat-list-request at redhat.com?subject=unsubscribe
> >
> https://www.redhat.com/mailman/listinfo/redhat-list
> >
> >
>
>
> --
> redhat-list mailing list
> unsubscribe
>
mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
More information about the redhat-list
mailing list