Questions tagged [fifo]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

FIFO sometimes requires two writes to satisfy read

I found some baffling behavior on Ubuntu 18.04.4 LTS. In one terminal, I'd like to write a private key to a FIFO. $ mkfifo /tmp/fifo $ chmod o-rwx /tmp/fifo $ chmod g-rwx /tmp/fifo $ cat id_rsa > /...
3
votes
0answers
47 views

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

Trap SIGPIPE upon writing to FIFO

These are the steps to reproduce the problem. writer: #!/bin/bash trap 'echo NoReader!' PIPE cat > fifo Open two terminals. I will denote them by the >T1< and >T2< headers below, and ...
1
vote
0answers
27 views

Is it possible to have SSH display an “active” banner, by running a script to generate the banner each time, rather than read a static file

The sshd_config banner directive reads a file, but I want it to run a script, and ideally personalize the banner to the user... is this possible with ssh, or is there a way I can create a device file ...
0
votes
0answers
22 views

rx_fm and multimon with fifo pipe not forwarding

My desire is to build a "switch", that mutes (switches off / on) the flow to play according to the output of multimon-ng, so after a certain decoded message I want to play the demodulated ...
0
votes
2answers
35 views

how to redirect a pending firefox download to a named pipe?

My router provides a live capture in an fancy web interface full of authentication and JS stuff. So if I capture the traffic firefox download a pcap file til I stop the job. I want to be able to see ...
1
vote
0answers
53 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 ...
1
vote
0answers
34 views

Combine mkfifo and cp --reflink to append files without copying data

I have huge files {0..9}.bin which I want concatenate into out.bin. I don't need the original files afterwards. So I was wondering, if this is possible by only modifying the filesystem index without ...
1
vote
1answer
51 views

Named pipe stdout redirection instead of numeric file descriptor

So I was fiddling around for hours now. I have the following problem: I am running a command (node.js script) that writes to stdout via process.stdout.write. It is interactive and at one point it ...
1
vote
2answers
31 views

How to read server stdout and continue only after message is outputted

Say I have a simple Node.js server like: const http = require('http'); const server = http.createServer((req,res) => res.end('foobar')) server.listen(3000, () => { console.log(JSON....
1
vote
0answers
19 views

Piping two audio FIFOs simultaneously, where one may not have data but takes priority, into a single FIFO output

I have a snapcast audio server, which is configured to have three audio streams (fifos): music, broadcast, and output. My speakers play the audio from the output stream, and my music players pipe ...
0
votes
1answer
31 views

Command to create/connect to an I/O stream?

So I'm trying to connect to a (Lua) debugger embedded in a program by redirecting the I/O. Currently I create a pair of FIFOs for the read and write streams and connect to them using cat /tmp/...
2
votes
0answers
161 views

Looking at the kernel logs to see if there is something wrong with my machine

My ubuntu machine slowed down, I was following these instructions: https://askubuntu.com/questions/21632/slow-response-and-system-lag the slowness I see is pretty uniform, and there's definitely a ...
0
votes
0answers
15 views

Piping Multiple stdouts to Python program?

I have a program that prints in stdout and I'd like multiple instances of it where each instance's stdout is piped to a sed and then the result(of three such sed) piped to a python program. I'm doing ...
0
votes
1answer
40 views

What is this code actually doing?

While doing a CTF challenge on a platform, I needed a reverse shell but couldn't get one working so I looked at the processes and found one reverse shell code: rm /tmp/m;mkfifo /tmp/m;cat /tmp/m|/bin/...
0
votes
0answers
16 views

Streaming to FIFO-Q: how to copy into two streams, and operate on the new streams?

This question is about pipes, and I have created a small problem to illustrate my issue. Suppose I have a file: // foo.csv a,b,c d,e,f In script bar.sh, I do the following: A=`mktmp -u` B=`mktmp -...
1
vote
1answer
747 views

Why is `BrokenPipeError` dependent on the size of the piped stream?

The following script raises BrokenPipeError: [Errno 32] Broken pipe, when piped to a command like head (unless the number of lines to head exceeds the number of lines printed by the Python script). ...
2
votes
1answer
16 views

Multiple Tracing Events Readers

Question Does the tracing pipes in Linux, for tracing events, accepts simultaneous readers? Context I am trying to get traces from the RAS subsystem while running some benchmarks. This subsystem ...
0
votes
1answer
220 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 ...
1
vote
1answer
88 views

GNU Parallel Python Semaphore

I have a Python script parallelized through GNU parallel which finds a certain result which I would like to output to a file, which I currently do through standard Python file IO. The issue is that I ...
1
vote
1answer
75 views

virt-install: send guest command from a host script

I can redirect virt-install input/output to console with the --console option: virt-install \ --name centos \ --ram 1024 \ --os-type linux \ --os-variant centos7.0 \ --graphics none \ --...
2
votes
2answers
134 views

Redirect stdout to command-A if success else stderr to command-b. While avoiding using temporary files

I have a command that writes to stdout when it is happy and stderr when it's not. I want to check the exit status of the command and do something with either stdout or stderr. if ! command >/tmp/...
0
votes
0answers
24 views

Set named pipe as pattern

Some introduction: I have a program, which works with named pipe and gives as output a directory with a certain name. The directory will be filling by several files with certain patterns (e.g., *R1* ...
1
vote
1answer
59 views

Reading n lines at a time from a named pipe in Ubuntu

I am experimenting with named pipes in Ubuntu and have no prior experience with them. I did the following: mkfifo pipe ls>pipe& cat pipe This enters a list of all files in my folder into pipe ...
0
votes
0answers
86 views

Script stuck writing to pipe, continues if attached to strace

I have an old set of bash scripts that communicate via a named pipe, that until recently, seemed to always work fine. This is the basic setup: # Script #1 $ mkfifo myfifo $ exec 3<>myfifo $ yad ...
0
votes
1answer
127 views

Linux FIFO buffering depends on invocation order of readers and writers

I'm trying to write a simple python script that reads from a fifo and then writes to another fifo. I have created two FIFOs using the following command: $ mkfifo input $ mkfifo output I invoke the ...
0
votes
1answer
41 views

Give control of terminal to server contacted via HTTP

I have an application that runs an HTTP server. The application also has a command-line interface. The app is written in Ruby and the startup time is significant. Using the command-line interface is ...
1
vote
0answers
38 views

How can I create a function that memoizes other commands?

I have created the following function to memoize any command: # zsh (( $+functions[ec] )) || { ec() print -r -- "$@" ecerr() { ec "$@" 1>&2 } ecdbg() ecerr "$@" gq() { ec "${(q+...
23
votes
2answers
2k views

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

I've used the mkfifo <file> command to create named FIFOs, where one process writes to the file, and another process reads from the file. Now, I know the mknod command is able to create named ...
0
votes
1answer
277 views

How to properly write a string to a named pipe and the difference between echo and printf

Problem: I need to send a command to a named pipe and need to ensure only the command is sent and not any errant or "fat-fingered" characters. Example: I have been using the following: echo "...
1
vote
1answer
75 views

How can I merge two sorted named pipes with uneven sizes?

My question is similar to "Merge two sorted files based on sorting values in the same field" but extending it to named pipes. Say I have two text files with sorted integers and I want to merge them. ...
0
votes
1answer
35 views

Why don't named pipes respect the order at which readers were attached?

I have this test script: #!/usr/bin/env bash fif="foooz"; rm "$fif" ; mkfifo "$fif" ( cat "$fif" | cat && echo "1") & sleep 0.1 ( cat "$fif" | cat && echo "2") & sleep 0....
0
votes
2answers
2k views

Check if named pipe is open for reading

Right now, I have this crappy check to see if a named pipe is being read from: is_named_pipe_being_read() { local named_pipe="$1" echo "unlocked" > "$named_pipe" & pid="$!" #...
2
votes
1answer
394 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 ...
2
votes
1answer
809 views

How to check for presence of named pipe on the file system [duplicate]

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 ...
2
votes
2answers
814 views

How to cat named pipe without waiting

If there is nothing in a named pipe and I do: cat my_named_pipe it will wait until data arrives. Is there a flag I can use to exit immediately if there is no data to be read? Or perhaps a command ...
6
votes
2answers
153 views

Difference between > and >> when used with a named pipe

Is there any difference between the two redirections in the following code? mkfifo foo echo > foo echo >> foo
0
votes
1answer
86 views

Process exits unexpectedly when sending to a named pipe

I have two processes and one named pipe. One process is actively reading from the pipe, and one process is sending data to the pipe continously. The command that sends to the pipe is the following :...
-1
votes
1answer
593 views

Writing continuously to named pipe

I have a problem that I can't seem to solve involving two named pipes. Basically, I have two processes that I don't have control over. They are communicating via named pipes (mknod pipe p). Process ...
0
votes
1answer
48 views

Run program when/instead of writing to FIFO? [closed]

I have a program that writes data every second to a FIFO. Now I want to alter some of this data and write it to another FIFO. What would be the best approach? Can I somehow pipe this directly to my ...
4
votes
1answer
384 views

Make GNU Parallel not delay before executing arguments from STDIN

GNU Parallel, without any command line options, allows you to easily parallelize a command whose last argument is determined by a line of STDIN: $ seq 3 | parallel echo 2 1 3 Note that parallel does ...
2
votes
1answer
223 views

concurrent processing in bash using process expansion, and redirection

Apart from possible races that have to be controlled by using proper synchronisation, it's possible in bash to feed a data source concurrently into multiple pipelines and collect all their outputs ...
1
vote
2answers
61 views

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 ...
6
votes
3answers
347 views

What characterizes a file in Linux/Unix?

What characterizes a file in Linux/Unix? A file can have many types: regular file, directory, symlink, device file, socket, pipe, fifo, and more that I miss. For example, a symlink: $ sudo file /...
5
votes
2answers
443 views

grep --exclude option doesn't always skip named pipes

I have a directory that contains, among other files, 3 named pipes: FIFO, FIFO1, and FIFO11. If I try something like grep mypattern * in this directory, grep hangs forever on the named pipes, so I ...
3
votes
0answers
677 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 [...
2
votes
2answers
134 views

Bash: join pipes without deadlock

I want to list a bunch of filenames via find, pipe them through a utility (let's call this util) which outputs a new name for each input name, and then rename each file from the old name to the new. ...
0
votes
1answer
113 views

How to Pipe Segment of Heredoc Output to Local File

I am issuing a command to a remote device in order to run a tcpdump on one of it's interfaces, but capture the output to a local .pcap file on my Ubuntu VM. The command that I'm issuing is as follows: ...
0
votes
1answer
679 views

How to Pass Multiple Commands to Remote Device via SSHPass [duplicate]

I'm trying to setup a method in which I can run remote tcpdumps on some of my devices, and save the file to my local machine for analysis (I don't want to save the file on the remote device and then ...
3
votes
1answer
2k views

Using exec 3> to keep a named pipe open

The process reading from a named pipe will normally terminate when the process writing to the pipe finishes writing (sends an EOF). In certain situations you may have different processes writing ...

1
2 3 4 5