Run a cgi shell script in background

前端 未结 1 938
野性不改
野性不改 2021-01-03 11:02

I\'ve a cgi shell script like this

#!/bin/sh

# show the page
echo Content-type: text/html
echo
echo \"Hello world!

        
相关标签:
1条回答
  • 2021-01-03 11:34

    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.

    0 讨论(0)
提交回复
热议问题