Questions tagged [fifo]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
33 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; ...
7 votes
4 answers
4k views

How do I make systemd sockets close when service is stopped?

I'm currently trying to make a systemd service with two Fifo sockets. These sockets map to stdout and stdin of the application. I'm currently using the following configuration files. foo.service [...
0 votes
0 answers
10 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 ...
0 votes
1 answer
151 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 ...
0 votes
1 answer
3k views

Named pipe buffer after process end

I am creating named pipes in Ubuntu 18 and 16 environments in C language using gcc as compiler (mkfifo() and open()). One of the things I noticed that the named pipes remain in the filesystem after ...
0 votes
0 answers
48 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 ...
1 vote
1 answer
197 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 ...
1 vote
1 answer
1k views

strace for troubleshooting inter process communication

I have output captured by following command: strace -f -e trace=process,socketpair,open,close,dup,dup2,read,write -o rsync.log rsync -avcz --progress src/ dst/ it is a bit long so I've uploaded it ...
1 vote
1 answer
63 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 ...
0 votes
1 answer
135 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 ...
0 votes
0 answers
29 views

How to implement lossy buffering? [duplicate]

I want to capture log data and analyze it in real time. Specifically the output of mysql's slow query log. However this needs to be minimally invasive. Pointing the source to a FIFO rather than a ...
12 votes
3 answers
7k views

Buffering (named) pipe in GNU OS

In the GNU OS a process can only write data to a pipe if another process reads the same data (from the same pipe) at the same time. Is there something like a pipe which lets the 1st process write and ...
3 votes
2 answers
3k views

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 ...
1 vote
1 answer
3k views

mkfifo with all permissions still errors with permissions denied for other user

Ubunbu 20.04 fifo pipe is created via a bash script from user A with: [[ ! -p $fifopath ]] && mkfifo $fifopath -m0777 This creates: prwxrwxrwx 1 A A 0 May 25 00:40 /tmp/somefifo Then, if ...
2 votes
2 answers
58 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
0 votes
0 answers
50 views

Not able to give input to my telnet connection through fifo file if I run it from script

I have a python script which is sending commands to a fifo file through this command. printf "command" > my1.fifo An another process (telnet login) is taking input from this my1.fifo ...
2 votes
1 answer
323 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" >&...
0 votes
1 answer
294 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 ...
3 votes
2 answers
825 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 ...
0 votes
2 answers
248 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(...
1 vote
1 answer
629 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 &...
12 votes
2 answers
17k views

Change buffer size of named pipe

I hear that for named pipes, writes that are smaller than about 512bytes are atomic (the writes won't interleave). Is there a way to increase that amount for a specific named pipe? something like: ...
55 votes
5 answers
41k views

Are FIFO, pipe & Unix domain socket the same thing in Linux kernel?

I heard that FIFOs are named pipes. And they have exactly the same semantics. On the other hand, I think Unix domain socket is quite similar to pipe (although I've never made use of it). So I wonder ...
3 votes
3 answers
13k views

How to send commands to fbi over SSH?

I'm using fbi to display some images. fbi has some keyboard controls, like +, -, Page Up, Page Down, etc. to control the images. Instead of using keyboard, I want to send these control commands over ...
3 votes
4 answers
157 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 ...
4 votes
1 answer
4k views

How to read a webcam that is already used by a background capture?

A ffmpeg webcam capture is running in the background. ffmpeg -f video4linux2 -s vga -i /dev/video0 capture.mp4 (1) I am therefore unable to read it with ffplay since the device /dev/video0 is ...
1 vote
1 answer
160 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/...
5 votes
1 answer
1k views

Don't wait for audio stream with ffmpeg/avconv using named pipes

I have two named pipes, audio_conv and video, for s16le and h264 streams, respectively. I want to convert them to webm format on fly. Data to these pipes proceeds from my application, that parses ...
2 votes
2 answers
804 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 ...
2 votes
1 answer
887 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 &...
2 votes
0 answers
197 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 ...
2 votes
2 answers
1k 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 # ...
0 votes
1 answer
1k 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 (!...
3 votes
1 answer
590 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 ...
2 votes
1 answer
982 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 ...
11 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 ...
-1 votes
1 answer
535 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 ...
21 votes
3 answers
77k views

continuous reading from named pipe (cat or tail -f)

I have configured rsyslog to log certain log events to /dev/xconsole: *.*;cron.!=info;mail.!=info |/dev/xconsole /dev/xconsole is a named pipe (fifo). If I want to see what is being logged, I ...
5 votes
1 answer
1k 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 ...
0 votes
2 answers
125 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 ...
2 votes
2 answers
962 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&...
1 vote
0 answers
810 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 ...
0 votes
0 answers
29 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 ...
1 vote
1 answer
62 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 ...
1 vote
0 answers
105 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=&...
1 vote
1 answer
193 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 ...
4 votes
1 answer
76 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       └─────&...
0 votes
0 answers
232 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.
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 ...
2 votes
1 answer
4k 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 ...

1
2 3 4 5