Is there any way to tell when an X-Sendfile download has completed?
In the interest of cleaning up temporary files on the webserver, I'm wondering if there's any way to tell when X-Sendfile downloads complete... maybe in a log somewhere? My understanding currently is that once you pass of开发者_运维技巧f the headers it is basically on its own.
If possible, you can temporary shutdown apache gracefully with apachectl -k graceful-stop
. When stopped, after all requests are finished, you can remove the temporary files and start apache again.
Apache only logs a hit once the connection's closed, which presumably would be whenever the download is finished. So monitoring the access log for the specific download url would tell you when it's completed - comparing the logged bytes-sent v.s. how much you expected to send will also tell you if the download was successful or if it was aborted.
I don't know of such way, but if you are running on Linux, then I think you can safely remove the file even if a download is still in progress. The file will be deleted immediately but the inode will be kept intact until all references to it are gone.
精彩评论