Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [fifo]

Questions about FIFO - first-in first-out special file, also known named pipe

Filter by
Sorted by
Tagged with
2 votes
2 answers
79 views

Finding the processes trying to open some FIFO

In my example, the wc program is trying to open the test FIFO or named pipe. These in-progress open syscalls seem not to be shown by fuser or lsof: mknod /tmp/testpipe p wc /tmp/testpipe & timeout ...
Juergen's user avatar
  • 722
0 votes
0 answers
17 views

How do I determine if a path is a fifo? [duplicate]

I have some bash shell code that runs if [[ ! -s "$1" ]] to determine if $1 is a non-empty file This test fails if $1 is a fifo, even though the fifo has data in it ready to be read. Is ...
Greg Dougherty's user avatar
1 vote
0 answers
61 views

Redirecting fifo to python's stdin

$ mkfifo mypipe $ echo "hello redirection" > mypipe $ cat < mypipe hello redirection I have problems when I try to do the above with python # pyecho.py with open("/dev/stdin&...
Tom Huntington's user avatar
0 votes
0 answers
37 views

What makes named pipes special as compared to regular files? [duplicate]

Take this: in one terminal, touch myfile echo some text >> myfile # returns straight away in another terminal, cat myfile # prints "some text" now I can rm myfile Now this: in one ...
Enlico's user avatar
  • 1,677
1 vote
1 answer
37 views

Strange behavior with sed/head and named pipes/FIFOs (needs two writes)

I have a fifo created with mkfifo in a shell, opened in rw mode with exec 3<>fifo. When I run sed 1q <&3 and write a line to the fifo in another shell, sed doesn't print the line until I ...
SeetheMoar's user avatar
0 votes
1 answer
17 views

rsyslogd v3.x.x unexpectedly closes write connection to named pipe target

I've configured rsyslog to forward certain log messages to a named pipe /tmp/logger.pipe. I then have a separate process reading from the named pipe. Relevant section from /etc/rsyslog.conf # Remote ...
Izzo's user avatar
  • 971
0 votes
0 answers
41 views

What does rsyslog do if it fills up a named pipe?

I'm working on a C application that is intended to monitor and process the output of rsyslog. My research shows that a way to do this is to create a named pipe and then create a new syslog target that ...
Izzo's user avatar
  • 971
3 votes
0 answers
316 views

named pipe (mkfifo): how to detect on macos that the reading end (consumer) has disconnected, without the consumer writing to the write end?

Note: this is about the producer detecting the consumer disconnecting, not the consumer detecting that the producer disconnected (aka EOF). The producer might not write any data for long periods, but ...
TheDiveO's user avatar
  • 1,337
0 votes
0 answers
36 views

Strange incongruent output for both nc and fifo

I have this exact code: #!/bin/bash gtimeout(){ if type -f gtimeout &> /dev/null; then command gtimeout "$@" else timeout "$@" fi } export -f gtimeout; ...
Alexander Mills's user avatar
0 votes
0 answers
16 views

Simulating control characters such as "H key" , "UP arrow key" , etc

I have a Device 1 which has debian OS installed on it. I access the serial console of it through other device i.e. Device 2 . I have scripts on the device 2 which will uninstall and install different ...
Anubhav Rai's user avatar
0 votes
1 answer
438 views

Continuously polling a named (FIFO) pipe

I am trying to use a named pipe to monitor the activity of a running shell script. That shell script will write to the pipe that it has "Started" processing. When it has completed ...
nbmlane's user avatar
0 votes
0 answers
97 views

Simultaneous input from fifo and terminal in bash

I am running ffmpeg inside a script and I want to be able to quit ffmpeg either by pressing 'q' in the terminal it's running in (default behaviour) or by inputting 'q' into a fifo file, whichever I ...
Mouse'nKeyboard's user avatar
1 vote
1 answer
541 views

send (alsa) audio via network via UDP

This to my understanding records mono in wav format for 300 seconds to a named pipe called "mic_rec" rec arecord -D hw:4,0 -d 300 -f cd -t wav -c 1 mic_rec And this sends whatever it finds ...
Daniel's user avatar
  • 153
1 vote
1 answer
105 views

Allow a sudo sub process to update Zenity running as original user

A script run by user 'staffer' runs zenity --progress. It then calls sudo -u adminBod adminScript (and the STDOUT and STDERR are collected to logger) I want adminScript which is running as adminBod to ...
artfulrobot's user avatar
  • 2,949
0 votes
1 answer
294 views

Filtering log statements before they're written

I have an application I need to run in verbose mode to get the information I'm interested in. This produces an enormous log file that is <1% interesting for my requirements.I want some way of ...
Stephen Boston's user avatar
2 votes
2 answers
70 views

Process not showing under ps -ef | grep command

I ran a command in shell cat >my1.fifo & and when trying to find the PID it is not showing under ps -ef | grep my1.fifo
Anubhav Rai's user avatar
0 votes
1 answer
614 views

Grant Permission to Run Process with FIFO

I am trying to run a program that sets its own scheduler policy to sched_FIFO, but it errors out saying operation not permitted. If I run it with sudo then it succeeds, but I want to reduce the ...
Chad's user avatar
  • 73
3 votes
2 answers
2k views

How do I attach a bash shell to a named pipe?

Let’s say I have two containers X and Y (two containers in the same Kubernetes pod, actually) that share a volume. On that volume is a named pipe /foo that I want attached to a bash process on ...
koehn's user avatar
  • 183
0 votes
2 answers
326 views

when read buffer size is 2048, it work , but buffer size is 48 or other number, write call will be blocked, why?

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/select.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char* argv[]){ if(...
zhenfei ren's user avatar
2 votes
1 answer
1k views

Usage of named pipe as data source for netcat

I want to use netcat as a TCP-server that reads data from a named pipe. For that I did the following: Step 1. Created a pipe and the server that uses it as a source mkfifo /tmp/all.pipe nc -k -l 8080 &...
ka3ak's user avatar
  • 1,265
3 votes
4 answers
178 views

Protect against vanishing output redirection targets

I have a daemon running on an embedded Linux device with its output redirected to the serial console: my_daemon > /dev/ttyS0 But now if a user exits the shell running on the serial interface then ...
phk's user avatar
  • 5,983
1 vote
1 answer
226 views

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/...
steffen's user avatar
  • 121
3 votes
2 answers
1k views

Reading from two fifos in Bash

I'm trying to read from two fifos (read from one, if there's no content read from the other, and if there's no content in neither of both try it again later), but it keeps blocking the process (even ...
Roger Miranda Perez's user avatar
2 votes
1 answer
1k views

bash IPC using named pipes

Consider the below script #!/usr/bin/bash chan=/tmp/pipe.$$ mkfifo $chan { for x in a b c d e do echo $x > $chan done } & for y in 1 2 3 4 5 do x=$(cat $chan) echo &...
balki's user avatar
  • 4,457
2 votes
0 answers
226 views

FIFO and simple bash parallelization on CentOS

I am having problems adapting a bash script to handle a simple parallel execution from Ubuntu 20.04 to CentOS Linux 8. In the script I spawn multiple "readers" that read a string from a FIFO ...
Sine's user avatar
  • 21
0 votes
1 answer
2k views

Writing in the file descriptor of the child process (fd/0)

I'm playing with file descriptors in my CentOS 7 sandbox. In doing so, I noticed an interesting situation. Suppose we've a simple PHP script: $step = 4 * 1024; echo "php started\n"; while (!...
novascriptum's user avatar
2 votes
1 answer
1k views

Bash named pipes, parallel commands and exit status

I'm trying to use a named pipe so I can keep stdout for status output from a long process. I could use stderr for status output, but I'd like to keep that for errors. Here is an example: #!/bin/bash ...
A. Que's user avatar
  • 643
4 votes
1 answer
903 views

Close all readers of a FIFO once all its input is read?

How can I close all readers of a FIFO once all its input is read? Seems I can only get one of them to close, which keeps my program from finishing. Here's a sample program that works (to test put it ...
rutchkiwi's user avatar
  • 175
12 votes
2 answers
5k views

Linux named pipes: not as FIFO as thought

In short: mkfifo fifo; (echo a > fifo) &; (echo b > fifo) &; cat fifo What I expected: a b since the first echo … > fifo should be the first to have opened the file, so I expect ...
Marcus Müller's user avatar
0 votes
1 answer
797 views

named pipe in bash script

I have a C program to experiment with signals (./signal). It processes the standard input, exits when reading a 'q' and reacts to signals. I would like to test it with a bash script using a named pipe ...
z32a7ul's user avatar
  • 435
5 votes
1 answer
2k views

How should I set up a systemd service to auto-start a server and let me pass commands to it?

Goal: I'm trying to get a Minecraft server to run on computer boot with systemd on Fedora. I have a few self-imposed criteria that I need to meet to be able to properly manage my server(s): It has to ...
Riley's user avatar
  • 65
0 votes
2 answers
143 views

Do any shells generalize the notion of pipes to multiple parallel pipelines? Would supporting it require changes to the OS kernel?

Quite often, when working on the command line, I find myself specifying the same operation on a bunch of different instances specified by some input stream, and then wanting to recombine their outputs ...
reinierpost's user avatar
2 votes
2 answers
1k views

Can we use $PIPESTATUS with the tee (or pee) command?

In my bash scripts, I often use pipes and would like to know which stage of the pipe was causing the problem in case of errors. The basic structure of such snippets is: #!/bin/bash ProduceCommand 2&...
Binarus's user avatar
  • 3,440
1 vote
1 answer
1k views

Write firmware over /dev/ttyUSB0 to embedded device

I'm using the last example in: this post. I keep getting wctx:file length=0 after the sz command. I'm actually opening the serial connection with minicom Minicom is botching the transfer. So, after I ...
Brian's user avatar
  • 168
2 votes
1 answer
378 views

Can named pipes/FIFOs be used in a "cyclic" manner together with `tee`?

Why does the last line in this script gets stuck? #!/usr/bin/env bash trap 'rm -f numbers' EXIT mkfifo numbers decrement() { while read -r number; do echo "debug: $number" >&...
Ionuț G. Stan's user avatar
0 votes
0 answers
33 views

Using a ‘permanent’ named pipe as input to a program [duplicate]

I’ll admit I don’t fully understand named pipes. I’ve read everything I can about them, but I’m still not sure how to keep one ‘open’ for repeated use. Basically, I want to use a named pipe as input ...
tjcaul's user avatar
  • 101
1 vote
1 answer
81 views

Bash: Difference between paste command with Command Substiution vs. FIFO FDs

I'm just trying to understand why when I use a couple FIFO FDs in a paste command I get a 'Broken Pipe' but when I use Command Substitution everything is all good. A little background: I have a need ...
Wafflemann's user avatar
1 vote
0 answers
114 views

bash script to lazy tar to fifo as files arrive

Here's the hypothetical scenario: I have an archival process where files are showing up and I append them to tar, and then the tar gets zipped. Something like this: while sleep 1 ; do new_files=&...
galets's user avatar
  • 1,207
1 vote
1 answer
231 views

Using named pipe to get process substitution exit codes

I have a script with a fairly complex command with several process substitutions and I need to get the exit codes from the commands in the process substitutions. I'm trying to do so via a named pipe ...
Harry Muscle's user avatar
  • 2,547
4 votes
1 answer
93 views

What's wrong with this branched data flow using `tee`, fifos, and `paste`?

In the spirit of this question, I want to create a branched data flow from a single source: cmd1 ──> tee ──────────────> │    ├─────> cmd2 ─────> │ cmd4       └─────&...
Sasgorilla's user avatar
0 votes
0 answers
333 views

zsh, zpty: How to read the output of a process after it has exited?

Start some command with zpty: zpty -d x ; zpty x 'echo hi' ; sleep 1 How do I read its output now that it has exited? zpty -r x Returns 2, and this behavior seems expected per the manpage.
HappyFace's user avatar
  • 1,620
0 votes
2 answers
2k views

How can I read from named pipe line by line and exit?

I have the following bash script that I'd like to use as a fuzzy file opener. I create a fifo, spawn a new terminal with fzf running and redirect fzf's output to the fifo. I then call a function that ...
noibe's user avatar
  • 387
3 votes
1 answer
5k views

Can multiple processes open a named pipe?

I'm creating a process that is going to publish data via a named pipe and I envision there being multiple subscribers. Is there some way my process can Tee off the named pipe it is wring too each time ...
Nick's user avatar
  • 153
6 votes
2 answers
740 views

coproc and named pipe behaviour under command substitution

I have a requirement to make a function in a zsh shell script, that is called by command substitution, communicate state with subsequent calls to the same command substitution. Something like C's ...
Phil's user avatar
  • 175
0 votes
1 answer
588 views

Send signal to paused parent process and guarantee that it will arrive AFTER the parent pauses

I have this kind of pseudo-code and i'm wishing to know what I must change in order to guarantee that the signal send to the parent will indeed arrive after that the parent pauses. int main() { ...
Dacaramo's user avatar
0 votes
0 answers
406 views

Program execution hanging when trying to use fgetc() over a file stream returned by fdopen() function

I'm making a program where I'm creating 3 sets of fifos (named pipes) to comunicate over processes, I have found where the execution is hanging but not why, and now I'm stuck. I have identified that ...
Dacaramo's user avatar
2 votes
2 answers
2k views

FIFO-based semaphore explanation

I am trying to work on some parallelization of many processes (task send/to be executed on many (let's say hundreds) nodes). I came across this solution: https://unix.stackexchange.com/a/216475 # ...
Jozef Dzurenda's user avatar
2 votes
1 answer
143 views

Pipes and graphics

When developing a program (in C or Python, say), I often write debug messages to see whether my program behaves as intended. On Linux, such text messages can be handled in varied and flexible ways ...
Erik Aas's user avatar
  • 121
1 vote
2 answers
326 views

Ordering output when two subshells write to stdout

I have a command of the below form input | tee >(subshell) | mainshell Both subshell and mainshell writes to stdout. So their output is not synchronised. E.g. echo "Hello\nWorld" | tee &...
balki's user avatar
  • 4,457
1 vote
1 answer
1k views

Redirect script stdin to file in the background

In order to pass my script's stdin to stdin of a command in an alacritty instance it spawns, I'm trying to redirect it to a file in the background (so that the command can start reading it): t="$(...
OJFord's user avatar
  • 1,995

1
2 3 4 5 6