: How can I make Apache wait for images to be fully written to the storage drive before serving them? I'm using fswebcam to take pictures from my webcam and write them to /var/www so that anybody
I'm using fswebcam to take pictures from my webcam and write them to /var/www so that anybody can view them from my website.
The problem is that my server is a Raspberry Pi with a slow SD card. It takes several seconds to write the image to the SD card. If a user requests the image while it is still being written, they'll get a half-finished version of the image:
Is it possible to make Apache wait for an image to be fully written before it serves it?
More posts by @Yeniel560
2 Comments
Sorted by latest first Latest Oldest Best
Moving a file within the same disk is a very quick (nearly instantaneous) operation. Instead of saving them directly to www save them to a different directory on the same disk where Apache can't see them. Then when they are fully saved, move them into place in
I'm not sure about apache but I think some scripting language should be able to detect if a file is being written (perhaps using file handles?)
You can then wait for it to finish and serve the file.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.