Specific case:
generate_data | curl -T - http://someserver/path
That means, I have a program that generate an output in the stdout, and I put that on a remote server with curl.
The problem is that if generate_data
takes too much time, the server is going to return 408.
I know that pipes execute all the commands without waiting for data to be ready, so my next iteration was:
generate_data | ( sleep 20 ; curl -T - http://someserver/path )
The time was twice the max time needed to run generate_data, so all the things are ok. But... it is not a optimal solution.
I know I can create something more complex with read, and a proper shell script, but have the feeling that I an missing something obvious.
So... What can i use instead of the sleep 20;
without creating a temp file?
generate_data > /tmp/generated_data; cat /tmp/generated_data | curl -T - http://someserver/path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With