'Using a fifo as stdin to a process
How can I use a fifo to redirect stdin for a process?
Using systemd, I am starting a service that will infrequently require commands to be sent via stdin. To overcome this, I have tried the following:
mkfifo -m 600 cmdline
/usr/bin/cat cmdline | /opt/jdk-18/bin/java ...
I am able to run a command using the following.
echo -e "this_is_a_command\n" > cmdline
The problem I am having is that this only seems to work for a single command. After running this command once, all other calls to write into the fifo seem to just hang, and the server never process anything else.
How can I use a fifo to redirect input to stdin of a daemon process?
Solution 1:[1]
Can you try :
tail -f cmdline | /opt/jdk-18/bin/java ...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Philippe |
