LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   tar and ftp put on the fly (https://www.linuxquestions.org/questions/linux-general-1/tar-and-ftp-put-on-the-fly-333092/)

nifflerX 06-13-2005 10:55 AM

tar and ftp put on the fly
 
Hi,

I'm looking for a way to backup my data using an online storage facility. The facility only allows access through a kerborsed ftp client and my data is pretty big and has a ton of folders. Due to this I'd very much like to tar my directories so I can keep the directory structure if I ever have to get the data off this online storage facility. My problem is I don't have enough room to make a duplicate copy of my data in a tar file and send it, via ftp, to the storage facility. Is there a way I can tar and put data 'on the fly'? Basically I'm looking for a way where I don't need the space to hold an entire .tar file of all my data before putting it with ftp. Thanks very much.


-NifflerX


p.s. The distro I'm using is redhat linux if that makes a difference.

dub.wav 06-13-2005 05:44 PM

You have to use a named pipe.

Create the fifo and start tar:
mkfifo backup.tar.gz
tar cvzf backup.tar.gz / &

ftp to the host, and log in:
ftp hostname
Tell ftp to cat the pipe (just 'put backup.tar.gz' won't work)
put |"cat backup.tar.gz" backup.tar.gz

mhallbiai 06-13-2005 07:51 PM

just a note to dub.wav's instructions, you might want to make sure that you are transferring in binary mode before you start the upload depending on the types of files you are uploading

nifflerX 06-14-2005 09:01 AM

Thanks so much, I'll give this a try.

-NifflerX

EDIT: Worked like a charm. Thanks so much for the help!

nifflerX 06-14-2005 09:49 AM

Just a quick question. What do I do with the fifo file once I've got the tar file uploaded? Can I just delete it? Or is there a proper way to close it? Thanks again.


-NifflerX

dub.wav 06-14-2005 11:37 AM

You can just delete it. Any way I got the solution off google, and it was late so my mind wasn't working properly.
You don't need the named pipe, if you want to you can embed the tar command in the put command, like this:
Code:

put |"tar cvzf - /" backup.tar.gz
(I haven't tested it, but it should work.)

nifflerX 06-14-2005 11:45 AM

Thanks for info. I'll try this way as well, although the other way already works, so if something hitches I'll still be okay. Thanks again for all the help.

-NifflerX

EDIT: Just for general knowledge, both ways worked.


All times are GMT -5. The time now is 07:53 PM.