The tag has no usage guidance.

learn more… | top users | synonyms (1)

1
vote
2answers
44 views

run command with sudo su in script and redirect stdin and stdout

I need to run command as another user and write to its stdin and read from its stdout. I can run command as another user only via opening new shell: sudo su anotheruser but with new opened shell i ...
-2
votes
2answers
61 views

Pipe Named Fifo [closed]

I am implementing a named pipe to write and read data between two processes in cpp. The first process acquires a feature point from an image in real time while the second reads this feature point. It ...
3
votes
1answer
54 views

Joined pipelines

Considering a routine such as this one: alpha() { echo a b c |tr ' ' '\n'; } which outputs a stream, I would like to take the output stream, transform it, and paste it with the original output ...
5
votes
3answers
220 views

How to forward between processes with named pipes?

The /tmp/in, /tmp/out and /tmp/err are named pipes, already created and opened by some process (for reading, writing and writing, respectively). I would like to create a new process that pipes its ...
5
votes
2answers
321 views

Why does `cat` seem to iterate over JSON arrays?

I'm puzzled by this behaviour of cat when trying to output a heredoc containing JSON in bash 3.2: input: $ cat <(cat <<EOF > {"x":[{"a":1,"b":2}]} > EOF) output: {"x":["a":1]} ...
3
votes
3answers
94 views

Output to stdout works, fails when redirected to a file or a fifo

I have a Wifi antenna and I want to optimise it's position. For that propose I'd like to visualise the current latency in real time. I wrote a one-line script to output the ping latency: lat.sh: ...
2
votes
2answers
43 views

How do I close a FIFO pipe?

This script: #!/bin/bash tmppipe=/tmp/temppipe mkfifo $tmppipe echo "test" > $tmppipe cat $tmppipe exit Does not terminate. I assume that the cat command is waiting for an EOF from the pipe; how ...
3
votes
2answers
46 views

Including process output in tar file

I have a simple bash script to generate a compressed tar file and upload it to an external server for backup purposes. In addition to files on the server, I'd like to include dumps of a few mysql ...
3
votes
1answer
86 views

BASH: Fifo troubles - seems selective about input

So I am having a problem with a BASH service in Debian 7 that I've been working on for quite a while and that randomly started having trouble with its fifo, or so it seems. It is based on kind of your ...
3
votes
1answer
111 views

Using named pipes to send keypresses to an interactive program

I have a program, mpg123, which has an interactive mode that allows keyboard commands from stdin to do useful things such as control volume. I am trying to start up mpg123 so that it reads commands ...
1
vote
1answer
56 views

How to create dynamic process substitution based on the input (multiple FIFOs)?

I'm trying to create multiple process substitutions based on the output from the other command, however I'm not sure how I can achieve that. As sample scenario, I've given list of files: touch a.txt ...
2
votes
1answer
81 views

Printing from a FIFO pipe without interfering?

I have a couple of C programs sending messages back and forth through FIFO named pipes in Unix, and I want to see what's going through the pipes using an external program. The problem is that if I use ...
1
vote
0answers
52 views

Correct/Efficient/Reliable way to import log file entries to a MySQL database?

I'd like to be able to query our server access log files to identify abuse patterns. Log files really aren't very queryable, and it would be fairly easy to do what I wanted if each hit was a row in a ...
14
votes
9answers
718 views

Filter or pipe certain sections of a file

I have an input file with some sections the are demarcated with start and end tags, for example: line A line B @@inline-code-start line X line Y line Z @@inline-code-end line C line D I want to ...
2
votes
2answers
35 views

Triggering zero-byte reads on FIFO/pty

I'd like to know how to emulate the ICANON behavior of ^D: namely, trigger an immediate, even zero-byte, read in the program on the other end of a FIFO or PTY or socket or somesuch. In particular, I ...
1
vote
1answer
38 views

Is it possible to link file to an output of command line? [duplicate]

I want to create symlink, or a pipe, or something else that could be used in lieu of a file. I want that pseudo-file to execute a command and output of that command should become the contents of that ...
1
vote
0answers
132 views

'nc' using ~100% CPU when transferring a FIFO file

On the server which is always connected I’m using this in a crontab: @reboot nc -k -l 1337 < /tmp/fifo.fifo On the client which is not always on the network or switched on I’m using this ...
3
votes
2answers
296 views

Named pipes: several experiments leads to confusion [closed]

I've come across various articles and SO questions and I am still confused about something that I use on daily basis, but never realized how confusing it can be. I am experimenting with (named) pipes ...
-1
votes
1answer
34 views

What is the persistence of the handle of a broken FIFO?

Say an application opens for writing, a file, which is a FIFO to which something is “listening”, and later, this “listener” closes; if the application attempts to write to it, the application will get ...
1
vote
1answer
56 views

Non-block poll from two pipes?

Here is what I want to do.. mkfifo infrequentlog frequentlog sort -m infrequentlog frequentlog > mylog funcA > infrequentlog funcB > frequentlog So that when monitor tail, I can see the ...
2
votes
1answer
171 views

Bash Named Pipe - Atomic Reading

I have set up one script to write to a named pipe, then four scripts to read the named pipe. For most of the entries, there are no problems, but when there is little processing to be done on the ...
2
votes
1answer
171 views

Create a named pipe / fifo that executes a command when read

I'm looking to supply a process that only reads from a local file with content from an http URL. The process is a daemon that is hard-coded to read a specific file in it's current working directory ...
16
votes
1answer
743 views

Why is a named pipe as slow as writing to a file?

I'm trying to understand how named pipes work so that I can streamline my one-way interprocess communication. I expect some overhead due to copying data into a circular buffer, which I would have ...
4
votes
1answer
62 views

Why does my named pipe keep getting modified?

I have a named fifo created from a C program like this: res = mkfifo("/home/myfolder/myfifo", 0666); after that there are only reads and writes. Now, from this answer : Does a named pipe change ...
0
votes
0answers
103 views

Can rsyslogd write to more than one named pipe

If I have the following two lines in the rsyslogd.conf *.* |/var/run/rsyslog/pipe1 *.* |/var/run/rsyslog/pipe2 Will all messages be sent to both pipes? I have two programs that want to inspect ...
0
votes
0answers
123 views

Am I missing something for mkfifo to work?

I am trying to get frontend-term/omxplayer-console working on a raspberry pi. Specifically I am referring to the way I am supposed to be able to press keyboard characters and it translates those into ...
2
votes
2answers
268 views

How to read from a named pipe after the writer process exits?

I want to use named pipes as asynchrnonous task queues (JMS-like, perhaps). For example, suppose a client sends some data that I wish to insert into a database, but I want the client to disconnect ...
2
votes
1answer
197 views

create several /dev/xconsole files automatically upon boot

I understand from my previous question that the /dev/xconsole file can be created using mkfifo. On my system (Debian Wheezy), /dev/xconsole gets created automatically. I am wondering who creates it ...
2
votes
3answers
105 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 ...
5
votes
1answer
328 views

Why does “cat /tmp/out1 > /tmp/in2 &” appear as “bash” with the “ps” command?

Consider: mkfifo /tmp/out1 mkfifo /tmp/in2 cat /tmp/out1 > /tmp/in2 & When I run ps it appears as bash in the CMD section. Why?
1
vote
1answer
55 views

Custom python REPL with fifos

Is it possible to make a custom REPL (for e.g. python) with two fifos? Explanation of the problem Suppose I have two fifos in and out. I have three terminals. In the first I want to run commands ...
1
vote
2answers
286 views

mkfifo - Does disk I/O actually occur?

I have 2 applications: Producer (N instances) Consumer (1 instance) I currently write out intermediate results from the producers, and then the consumer reads these files from disk and produces a ...
1
vote
1answer
114 views

Why doesn't this piped script work?

#!/bin/bash rm out mkfifo out nc -l 8080 < out | while read line do echo hello > out echo $line done If I browse to the IP of the machine this script is running on (using port ...
3
votes
1answer
89 views

Can close() block?

For example, if you close a pipe or socket that still has data in its write buffer that hasn't been read by the process on the other end, does close() block until the data is read or the other process ...
5
votes
1answer
870 views

How do I use inotify or named pipes over SSHFS?

Thanks sshfs magic, I can mount my home dir from a remote server with sshfs user@server:/home/user ~/remote Optimistically, I thought I'd set a local inotify-hook on ~/remote/logFile (in the sshfs ...
5
votes
1answer
860 views

Communicating from bash with grunt shell

I'm tired of the slow startup time of hadoop fs just to query HDFS. This isn't a problem with HDFS itself though, because using HDFS file system commands within the Pig "grunt shell" is pretty fast. ...
2
votes
2answers
5k 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
1answer
173 views

What are the difference between those four commands (fifo, process substitution, redirection…)

My goal is to create a simple echo server using nc and a single fifo. I'm not looking for the best way to do it, I'm merely trying to understand the semantics of the following commands (when does fork ...
1
vote
1answer
176 views

How to redirect logs to a fifo device?

I have the following line in the rsyslog config file: *.*;auth,daemon,kern,user -/dev/logi and it does what it should, but I wanted to send some iptables logs to a different file, so I added the ...
1
vote
3answers
1k views

How to remove all FIFO files with a shell command

I can't find a shell command to remove all the FIFO files inside a directory. In fact, for the removal of directories, the rm command offers the options -d, --dir, but for FIFOs it offers no option. ...
2
votes
1answer
822 views

closing the unwanted file descriptors

I am trying to understand how pipes work . This code snippet is from some website . So my understanding of the program goes like this : When we do pipe(fd) then fd[0]=3 and fd[0]=4 ( assuming only ...
3
votes
1answer
710 views

Prevent hanging of “echo STRING > fifo” when nothing is reading that FIFO

When I echo something to a named pipe made with mkfifo, it hangs if no process is reading from that pipe. How can I prevent that, i.e., stop that from hanging? And by the way, why is that hanging ...
1
vote
1answer
520 views

Using Fifo hang script

out="$katalog/out" # wyjscie fifo="$katalog/fifo" # wejscie mkfifo $fifo touch $out [...] #k ./a.out <$fifo >$out & pid=$! [...] # get input line by line loop start echo "$liniain" >> ...
6
votes
1answer
709 views

bash scripting - read tarball from stdin

I have a task I need to script that I feel should be stupidly simple, but I'm actually having a rather tough time. I have a short bash script that takes a specific type of application in tarball form ...
7
votes
5answers
973 views

Semi-asynchronous pipe

Assume I have the following pipe: a | b | c | d How can I wait for the completion of c (or b) in sh or bash? This means that script d can start any time (and does not need to be waited for) but ...
3
votes
1answer
2k views

How can I pipe commands to any terminal?

I often use more than one terminal (or terminal emulator) at a time; and while in X I can copy-paste commands, besides not being very practical, it obviously does not work on the real TTY. The first ...
5
votes
2answers
849 views

A virtual file containing the concatenation of other files

Is there a way of creating a filesystem object akin to this: mknod files p cat file1 file2 ... fileN > files but such that it can be seeked in, as if it were a regular file?
0
votes
1answer
552 views

Cat into fifo not running through bash

I want to script these few lines mkfifo my.fifo cat >my.fifo & cat my.fifo | nc remotehost.tld 10000 But the line cat >my.fifo & When i run it manually it works, but not through ...
3
votes
2answers
2k views

Why does a named pipe not get deleted after system restart?

As far as I understand, named pipes are not written to disk but are stored in memory. Here's how I created a named pipe - $ mkfifo pipe21 $ grep "simple" SimpleDoc.txt > pipe21 & [1] 2775 $ ...
1
vote
2answers
3k views

Cheapest way to find the oldest file (recursively) from a directory under heavy load

What is the least expensive way to find the oldest file in a directory, including all directories underneath. Assume directory is backed by SAN and under heavy load. There is concern that "ls" could ...