Questions tagged [mkfifo]
23 questions
6
votes
1 answer
Why doesn't mkfifo with a mode of 1755 grant read permissions and sticky bit to the user?
I'm creating a server and client situation where i want to create a pipe so they can communicate.
I created the pipe in the server code with
mkfifo("fifo",1755);:
1 for only user that created and root to be able to delete it or rename it,
7 for…
Joao Parente
- 163
- 6
6
votes
1 answer
How does this command work? mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc -l 1234 > /tmp/f
Today I was reading the nc man page and stumbled on this command. I know that:
mkfifo /tmp/f is creating a named pipe at /tmp/f.
cat /tmp/f is printing whatever is written to that named pipe
and the output of cat /tmp/f is been piped to…
The-null-Pointer-
- 173
- 1
- 5
5
votes
1 answer
How to check for presence of named pipe on the file system
I tried using the -f flag to test if a named pipe is present
if [[ ! -f "$fifo" ]]; then
echo 'There should be a fifo.lock file in the dir.' > /dev/stderr
return 0;
fi
this check does not seem correct. So perhaps a named-pipe is not a file, but…
user282164
3
votes
0 answers
How to pipe all output streams to another process?
Take the following Bash script 3-output-writer.sh:
echo A >&1
echo B >&2
echo C >&3
Of course when ran as . 3-output-writer.sh it gets the error 3: Bad file descriptor, because Bash doesn't know what to do with the 3rd output stream. One can easily…
Sinus the Tentacular
- 139
- 1
3
votes
2 answers
How to write something to named pipe even if there are no readers
I have this little test script:
rm fooo | cat
mkfifo fooo
echo 'bar' > fooo # blocks here
echo 'done'
I am guessing that because there is nobody reading from the named pipe, that the write call will block until then.
Is there some way to write…
Alexander Mills
- 9,330
- 19
- 95
- 180
3
votes
1 answer
What is the purpose of using a FIFO vs a temporary file or a pipe?
From APUE
FIFOs can be used to duplicate an output stream in a series of shell
commands. This prevents writing the data to an intermediate disk
file (similar to using pipes to avoid intermediate disk files).
But whereas pipes can be used …
Tim
- 98,580
- 191
- 570
- 977
2
votes
2 answers
Process in Pipe which Processes 256 bytes at a Time
I have a c program on a Cyclone 5 that does an FFT using the connected FPGA. This program currently takes 256 bytes from stdin and then process it gives the FFT results on stdout. I run it like this from the Linux bash on the Cyclone 5.
./fpga_fft <…
Flying Swissman
- 123
- 3
2
votes
1 answer
Using tee and paste results in a deadlock
I am trying to redirect stdout of a command into two "branches" using tee for separate processing. Finally I need to merge results of both "branches" using paste. I came up with the following code for the producer:
mkfifo a.fifo b.fifo
python -c…
HollyJolf
- 21
- 3
2
votes
1 answer
How to create a bidirectional pipe in bash?
I have a program which reads from and writes to file descriptor 3. I want to let it write to fd 3, and be able to write to the other end of the pipe interactively which the program should read over the same fd. I can create a pipe with mkfifo…
sherlock
- 586
- 1
- 6
- 17
2
votes
1 answer
pipe data into process that's already started
Say I start a node.js process like so:
node script.js &
is there a way to pipe data into that process after it has started?
normally, we do this:
cat | node script.js
but the problem I am seeing is that sometimes the node.js process won't…
Alexander Mills
- 9,330
- 19
- 95
- 180
1
vote
0 answers
Unable to redirect stdout for background terraform process after it received input from named pipe
I have a terraform file:
terraform {
required_version = "1.3.5"
}
locals {
a = "foo"
b = "bar"
}
in a bash terminal, I can do:
$ echo "local.a" | terraform console
"foo"
$ echo "local.b" | terraform console
"bar"
Now what I'm trying to do…
Foo
- 198
- 7
1
vote
1 answer
Speed up grep usage inside bash script
I am currently working on creating a bash script that is supposed to process large log files from one of my programs. When I first started the script took around 15 seconds to complete which wasn't bad but I wanted to improve it. I implemented a…
Dzamba
- 11
- 2
1
vote
1 answer
Process (mplayer) doesn't read from named pipe when started from webserver (lighttpd)
tl;dr
$ sudo -u www-data mplayer -slave -input file=/srv/mplayer.fifo -playlist /srv/list &
$ lsof /srv/mplayer.fifo | tail +2
mplayer 21059 www-data 4u FIFO 179,2 0t0 2359331 /srv/mplayer.fifo
$ cat…
steffen
- 121
- 6
1
vote
1 answer
mkfifo to copy / move files
Is it possible to use mkfifo (named pipes) in Linux to copy files?
For example: I am extracting files from tar archive and I want them to be moved immediately to another location.
micholeodon
- 85
- 6
1
vote
2 answers
Two named PIPEs (PIPE_in/PIPE_out) connected with `tail -f` | String sent to PIPE_in doesn't reach PIPE_out
1.Create named PIPEs, pipe_in and pipe_out by running:
$ mkfifo pipe_in
$ mkfifo pipe_out
2.Connect pipe_in to pipe_out:
TERM0: $ tail -f pipe_in > pipe_out
3.Send string hello world! to pipe_in and expect it to arrive at pipe_out:
TERM1: $ tail…
fmagno
- 113
- 2