I\'ve a cgi shell script like this
#!/bin/sh
# show the page
echo Content-type: text/html
echo
echo \"Hello world!
Close stdout with exec >&-
before you execute your long-running or background task. Maybe you'll also have to close stderr. That would be
exec >&-
exec 2>&-
(it seems you can't close both in one line)
This will break the pipe and allow your web server to send the data already outputted (such as via echo
) to the browser.