tar and fifos


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users tar and fifos
# 1  
Old 08-21-2006
tar and fifos

How can I make tar read data from a fifo, instead of storing it as a fifo?
# 2  
Old 08-22-2006
What exactly do you want to do? i.e. what are you running that tar command for?
--EDIT:
Do you mean something like this:
Code:
# ls -l pipe
prw-rw-r--   1 root     other          0 Aug 22 12:37 pipe
# tar -cf - *.pl > pipe &
[1]     13153
# gzip < pipe > pl.tar.gz
[1] +  Done                    tar -cf - *.pl > pipe &
# 
# ls -l pl.tar.gz
-rw-rw-r--   1 root     other       1496 Aug 22 12:38 pl.tar.gz
# gzip -dc pl.tar.gz |tar -tvf - 
tar: blocksize = 16
-rwxrwxr-x   0/1      705 Aug 22 11:08 2006 cat.pl
-rwxrwxr-x   0/1      974 Jul 31 15:06 2006 daemon.pl
-rwxrwxr-x   0/1      340 Aug 22 11:37 2006 dates.pl
-rwxrwxr-x   0/1      148 Aug 21 14:51 2006 getserv.pl
-rwxrwxr-x   0/1      215 Aug 22 12:21 2006 num.pl
-rwxrwxr-x   0/1      142 Jul 31 15:06 2006 test.pl
# gzip -dc pl.tar.gz > pipe &
[1]     13159
# tar -tvf - < pipe
tar: blocksize = 16
-rwxrwxr-x   0/1      705 Aug 22 11:08 2006 cat.pl
-rwxrwxr-x   0/1      974 Jul 31 15:06 2006 daemon.pl
-rwxrwxr-x   0/1      340 Aug 22 11:37 2006 dates.pl
-rwxrwxr-x   0/1      148 Aug 21 14:51 2006 getserv.pl
-rwxrwxr-x   0/1      215 Aug 22 12:21 2006 num.pl
-rwxrwxr-x   0/1      142 Jul 31 15:06 2006 test.pl
[1] +  Done                    gzip -dc pl.tar.gz > pipe &
#

# 3  
Old 08-22-2006
As in, I have a directory with several fifos in it, with background processes suspended waiting to feed whatever opens them. I want the data from these processes to be in the tar file, not a little marker saying "this file's a fifo".
# 4  
Old 08-22-2006
In other words, you have processes that write to fifos. Now you want tar to read from the fifos and write the output to a file/tape. Is that it?
# 5  
Old 08-22-2006
Yes, exactly.
# 6  
Old 08-22-2006
Well, see, there you have a problem. Cause tar needs filenames. Atleast the Solaris tar barfed saying something like that... If you just want to write to an output file, why not use dd?
--EDIT
Just tried tar on Linux and it failed too. Here's the simulation that I am using. It may not be anywhere near what you have, but its the closest that I'm gonna get.
Code:
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>

int main() {

        int fd,i;
        char a[2];

        fd=open("/tmp/pipe",O_WRONLY);
        if(fd==-1) {
                fprintf(stderr,"Error opening pipe: %d",errno);
                exit(-1);
        }
        for(i=65;i<91;i++) {
                sprintf(a,"%c",i);
                write(fd,&a[0],sizeof(char));
        }
        close(fd);
}

And here's how I am using dd:
Code:
$ ./a.out &
[1] 5795
$ dd if=/tmp/pipe bs=1
ABCDEFGHIJKLMNOPQRSTUVWXYZ26+0 records in
26+0 records out
26 bytes (26 B) copied, 0.000537 seconds, 48.4 kB/s
[1]+  Done                    ./a.out

Cheers

Last edited by blowtorch; 08-22-2006 at 12:03 PM..
# 7  
Old 08-22-2006
Quote:
Originally Posted by blowtorch
Well, see, there you have a problem. Cause tar needs filenames.
fifos have filenames.
Quote:
If you just want to write to an output file, why not use dd?
I want to include several compressed disk images in a tar file, so that I can stream them at once across the local area network, without having to store compressed copies on disk before sending. dd is great for copying one stream, in fact I've been using up to this point and intended to use it to feed the fifos, but it cannot multiplex several in a manner easy to seperate at their destination.

tar is being entirely too smart for it's own good, apparently. It could work if it'd just open the files. Is there any older, dumber archiver I can use?

Last edited by Corona688; 08-22-2006 at 01:30 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Tar - pre-checking before making the Tar file

Coming from this thread, just wondering if there is an option to check if the Tar of the files/directory will be without any file-errors without actually making the tar. Scenario: Let's say you have a directory of 20GB, but you don't have the space to make Tar file at the moment, and you want... (14 Replies)
Discussion started by: filosophizer
14 Replies

2. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

3. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

4. Programming

kill() function problem in client-server ipc message using 2 FIFOs

I want to have a message send & receive through 2 uni-direction FIFO Flow of data FIFO1 stdin--->parent(client) writefd--->FIFO1-->child(server) readfd FIFO2 child(server) writefd2---->FIFO2--->parent(client) readfd2--->stdout I need to have boundary structed message... (3 Replies)
Discussion started by: ouou
3 Replies

5. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

6. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

7. UNIX for Advanced & Expert Users

UNIX domain sockets vs FIFOs

Is there a performance advantage of one of these over the other? Obviously, it makes no sense to use normal TCP sockets or UDP sockets w/ the overhead they carry. But what about UNIX domain sockets vs FIFOs? I'd think they'd be very similar, in terms of performance and in terms of how they're... (2 Replies)
Discussion started by: mgessner
2 Replies

8. Linux

A little help understanding FIFOs?

This isn't strictly a Linux question, but... I've been working on a project to archive some streaming media for time shifting using 'mplayer' and have been using FIFOs to archive in Ogg Vorbis format: mkfifo program_name.wav (mplayer -ao pcm -aofile program_name.wav &)... (0 Replies)
Discussion started by: deckard
0 Replies

9. Programming

forks, ipc, fifos, update issues...

Hi, so I've got this program("main") that fork executes another ("user"). These programs communicate through fifos. One communication is a spawn call, where user passes an executable, main forks and executes it. So, I'm keeping track of all my processes using a task table. After the fork (for... (6 Replies)
Discussion started by: Funktar
6 Replies

10. Programming

Praying for help: FIFOs, IPC

omg i need help so bad. I've been working on a school project for what seems like an eternity and i'm close to deadline. Using FIFO's (i ahve to) to communicate between parent and child proc's. Right now I'm stuck on a read/write. fifomsg is a struct with int length and char message fields. ... (5 Replies)
Discussion started by: Funktar
5 Replies
Login or Register to Ask a Question