LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   tar get on the fly (https://www.linuxquestions.org/questions/linux-general-1/tar-get-on-the-fly-347047/)

nifflerX 07-26-2005 04:12 PM

tar get on the fly
 
Hi,

Thanks to you great people on this forum I can use

put |"tar cvzf - /" backup.tar.gz

to great a tar file on the fly to a secondary backup machine. I was wondering if there is a way to do the opposite. So I have backup.tar on my ftp site and I want to restore from it. Is there some similar ftp command I can use that will leave me with just the untarred contents of the tar file on my local drive? Thanks very much.


-NifflerX

mhen 07-26-2005 08:39 PM

The following -I think- should extract a tar archive from an ftp site into the current directory, though I have never tried anything like this so I don't know how well it will work.

Code:

wget -O - "ftp://whatever.ftp.server/backup.tar.gz" | tar -xvzf -
If you are thinking about trying this out in your root directory, or in any vital part of your filesytem for that matter, I defininately wouldn't recommend it.

nifflerX 07-27-2005 09:45 AM

Hi,

Thank you for the reply. This seemed to almost work, except that I'm not ftping into an anonymous site. The site is set up to use kerberos tickets. To connect I just ftp <site> and then hit return when it asks for a name (as it's picked the correct one up from the ticket). But with the wget command it's trying to connect as anonymous. Any way around this? Thanks very much.

-NifflerX

mhen 07-27-2005 10:09 AM

I don't know any way of doing this with the standard 'ftp' command, since it cant exactly send files to stdout.
I don't know anything about kerberos tickets either, so I can't help you with that.

I do believe, however, that you can get wget to connect with a username and password by specifying them in the url thus:
Code:

wget -O - "ftp://username:password@whatever.ftp.server/backup.tar.gz" | tar -xvzf -


All times are GMT -5. The time now is 03:50 PM.