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 from the server immediately and the server process pipe the data into a named pipe. Then completely independently read the data from the pipe and perform a SQL insert, which might be very slow - but the client doesn't notice because it gets a response immediately.
As a prototype, I thought this would work (for simplicity the "45" is echoed rather than sent through a netcat client-server pair):
zsh> nohup echo "45" > my_named_pipe &
zsh> exit
zsh: warning: 1 jobs SIGHUPed
Then much later, execute
zsh> cat my_named_pipe
But nothing comes out of the pipe. What's wrong with my setup?
PS: I've never got nohup
to work. I always rely on disown
which I don't want to do as a separate command in this scenario.
zsh 5.0.2
(though I wrote "bash" above). What happens when you do it? What version of bash do you use? If it works for you I should try that out myself. – Sridhar Sarnobat Nov 20 '14 at 21:46