Questions tagged [stdin]

32 questions
99
votes
7 answers

Can I send some text to the STDIN of an active process running in a screen session?

I have a long-running server process inside a screen session on my Linux server. It's a bit unstable (and sadly not my software so I can't fix that!), so I want to script a nightly restart of the process to help stability. The only way to make it do…
Richard Gaywood
32
votes
4 answers

Writing to stdin of background process

I'm on an Ubuntu 10.04 box, and started a server in the background (myserver &) over ssh. It's been running fine, but I need a way to get at the server's stdin, as the only way to control the server is through this method. Is there some way to get…
tajmorton
  • 435
  • 1
  • 4
  • 5
10
votes
4 answers

Is there a way to make objdump read from STDIN instead of a file?

In my specific case, I want to use it to dump what I echo. I don't want to involve any file... Is there a way to make objdump read from STDIN instead?
omg
  • 101
  • 1
  • 3
9
votes
1 answer

Write to stdin of a running process using pipe

I am in a similar situation as in this post But I couln't get the solution provided there to work in my situation as the answer seems related to that question only. In particular, I couldnt understand what was the purpose of cat my.fifo | nc…
aditya
  • 93
  • 1
  • 1
  • 3
9
votes
2 answers

Write to the stdin of a running process with the same effect/behaviour of directly writing

This post answers only partial my question. My problem is that writing to the stdin of the running process using the FD of process on the /proc filesystem does not have the same effect. Problem: start nc to listen on port 10000 (this process is…
Geo
  • 91
  • 1
  • 3
8
votes
4 answers

Testing for a script that is waiting on stdin

Is there a way to determine if a script is waiting on stdin and cause the command to exit if detected? Here's an example, the command I'm executing takes a long time to run, but it will also prompt for input before starting w/o a prompt. I want to…
Noah Campbell
  • 599
  • 2
  • 8
  • 15
7
votes
2 answers

How to send text to stdin of docker container?

I have a docker container which runs a java program in foreground on startup. The java program listens to input on stdin. How can I programmatically send text to the java program? The container is started with -it, so I can docker attach…
paolo
  • 387
  • 3
  • 14
7
votes
4 answers

Should a foreground program invoked by a daemon split logging between stderr and stdout based on severity levels?

Usually log messages are written to stderr. I'm wondering if it is a good idea/practice to split log messages so that errors and warnings go to stderr while debug/informational/notice messages go to stdout instead? Or is this irrelevant given that…
Rio
  • 325
  • 2
  • 10
5
votes
2 answers

How to keep script from swallowing all of stdin?

I have a script that reads from a pipe in a loop and runs an expect script and a normal shell script in the loop. Both scripts run ssh to another server to grab a piece of data. For example: cat /tmp/file | while read a b c d do s=`expect-script…
Justin
  • 51
  • 1
  • 2
5
votes
6 answers

Prevent sudo, apt-get, etc. from swallowing pasted input to STDIN?

I often write up wiki instructions to install various server packages on Ubuntu (11.10 Oneiric at the moment). They always involve things like: sudo apt-get install -y postfix sudo cp ~/siteconfig/etc/postfix/main.cf /etc/postfix but when you cut…
Jay Levitt
  • 219
  • 2
  • 6
4
votes
1 answer

BASH: alternatives to coproc

I have some scripts which use coproc to control stdout/stdin of subprocesses. Unfortunately, coproc was introduced in Bash 4.0, and on many systems I use, there is an earlier versions of bash. Are there any alternatives to coproc?
2
votes
3 answers

Suppress GPG "Reading passphrase from file descriptor 0" message

Simply, how can I make GPG not print that message? Here are the commands I'm using: echo "test input" > test.in echo "test" | gpg -q -c --passphrase-fd 0 --output test.enc --yes --force-mdc test.in echo "test" | gpg -q -d --passphrase-fd 0 test.enc…
Paul Tarjan
  • 559
  • 3
  • 8
  • 17
2
votes
1 answer

Write to the stdin of a running process (without changing the way of starting the program)

In this post there is described how to start a program and then to send data to the stdin of the program (with FIFOs). But what to do if the program is already running, and I cannot re/start the program?
Geo
  • 21
  • 1
2
votes
2 answers

Unix wrapper to make any binary accept stdin/stdout redirection

This is a common situation: you want to include command 'foo' as part of a pipeline, but unfortunately command 'foo' only accepts actual filenames for I/O and does not read/write from stdin/stdout. I know that there's an Unix command which acts as…
Jon Smark
  • 121
  • 1
2
votes
1 answer

CentOS 5.3, Perl, bash commands, Hide ALL output to screen

I am running the following command: [user@server ~]$ /usr/sbin/ntpdate -d IPREMOVEDFORSECURITY | egrep 'transmit timestamp' | tail -1 | awk '{print $4, $5, $6, $7, $8}' host found : HOSTREMOVEDFORSECURITY Tue, Feb 15 2011 12:38:38.321 So the issue…
Garrett
  • 23
  • 2
1
2 3