Questions tagged [fifo]

22 questions
8
votes
3 answers

Read non-blocking from multiple fifos in parallel

I sometimes sit with a bunch of output fifos from programs that run in parallel. I would like to merge these fifos. The naïve solution is: cat fifo* > output But this requires the first fifo to complete before reading the first byte from the second…
Ole Tange
  • 5,099
7
votes
1 answer

Multiple unix pipes not working

This first pipeline works fine (printing "c"): echo "a" | sed 's/a/b/' | sed 's/b/c/' This one does not do what I expect (nothing gets printed when I feed an "a" into my fifo ): mkfifo fifo; cat fifo | sed 's/a/b/' | sed 's/b/c/' However, if I…
7
votes
1 answer

How long do FIFOs (named pipes) stay "open" for?

For example, I have a script that writes the time to a pipe in /etc/pipe. It writes continuously in a while true loop. How long will the data in the pipe be available for reading? If I only decide to read the pipe a day later with cat /etc/pipe,…
nopcorn
  • 16,982
6
votes
3 answers

Can bash consume the same fifo from two separate commands?

I have a huge data source that I'm filtering using some greps. Here's basically what I'm doing right now: #!/bin/bash param1='something' param2='another' param3='yep' echo $(avro-read /log/huge_data | grep $param1 | grep "$param2-" | grep $param3 |…
Andrew
  • 351
5
votes
2 answers

How to prevent terminating command to send EOF to named pipes?

The problem I faced is exactly this one: http://www.linuxmisc.com/4-linux/d7863c256bccbfb6.htm I want to be able to run a program which takes stdin, and write data to it whenever I feel like it. I can do this with fifo named pipes. e.g.:…
justhalf
  • 183
5
votes
1 answer

can't scp a named pipe

I am trying to encrypt a file on-the-fly, redirecting the output to a named pipe [fifo]. I SSH into my server and run the command: $ mcrypt -k key < file > named_pipe then from my laptop I try to scp it: $ scp…
Matt
  • 787
4
votes
2 answers

Keeping bash open on a named pipe

I'm looking to send commands to a separate tmux pane from vim and I figured the easiest way was to mkfifo a named pipe /tmp/cmds and run bash < /tmp/cmds to listen for commands to run. I then do echo "echo \"hello world\" > /tmp/cmds" as test, this…
4
votes
2 answers

How can I redirect sound to a FIFO file?

I have a program which uses FIFO files for interacting with the user. An audio call can be made directing the output of arecord to one of the program's FIFO files: arecord -r 48000 -c 1 -f S16_LE > call_in An audio call can be answered by directing…
2
votes
1 answer

How to pipe the output of a linux command back into the predecesssing command

The linux command nc -l 8090 | (read METHOD URI PROTOCOL ; echo "method: $METHOD" ; echo "path: $URI" ; echo "prot: $PROTOCOL") listens to port 8090 and when I type something like http://127.0.0.1:8090/path/to/nowhere into my browser it prints out…
jederik
  • 127
2
votes
1 answer

how to convert a script using pipelines to named pipes

I have a bash script that is using anonymous pipes to achieve: grabbing video from dv capture device writing to a file (using tee) piping it to ffmpeg2theora (converting to ogv/theora video) writing to a file (using tee) piping it to oggfwd in…
Luka
  • 21
2
votes
1 answer

Shell pipes - the order of things

Because netcat on my box doesn't support -e, The netcat man page gives me this workaround: $ rm -f /tmp/f; mkfifo /tmp/f $ cat /tmp/f | /bin/sh -i 2>&1 | nc -l 127.0.0.1 1234 > /tmp/f I don't understand how this works. I though that when you try to…
2
votes
1 answer

Why does du -sk fail to report the size of a fifo?

There is a concept in bash called process substitution. You can run a command and use the output as a file. e.g. $ cat -n <(seq 3|tac) 1 3 2 2 3 1 I am curious why the following fails; $ du -sk <(xzcat /var/log/mpd/scribble.log.xz…
2
votes
1 answer

Create STD IN/OUT Buffer for a Program Running in a Screen Session

Environment Linux version 2.6 Screen version 4.03.01 I am running an application inside of a screen session. The program prints to STDOUT and reads from STDIN. What I would like to do: First, have STDOUT of the screen tee'd to a file. For some…
Tim
  • 200
2
votes
0 answers

ffmpeg: convert mjpeg fifo into mp4 stream - on the fly- to render in chromium

I have a mjpeg stream in a fifo (comes from gphoto2 --capture-movie) and I want to play that stream in chromium. To capture the mjpeg stream I use: gphoto2 --capture-movie --stdout> fifo.mjpg Now I'm having hard times to figure out how to convert…
1
vote
1 answer

automatically start netcat on localhost and remote-host and keep it active

I found this answer by @jeremytrimble on Stack Overflow which explains how you can read a FIFO file over network. I wonder if it’s possible to start these netcat commands automatically, e.g. in a crontab file (@reboot nc …). How would I keep them…
fooness
  • 51
1
2