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?