How to wait for file to be closed before reading
Posted on 2014-11-14
I have my scanner here at the office FTP'ing scanned documents to a server.
Additionally, I have a php script running indefinitely checking the ftp upload folder and creating thumbnails for those PDF images.
The problem is, if the scanner hasn't finished writing the document to the ftp server, the script fails because it is not a valid PDF document.
I am using ghostscript to create the pdf preview if that helps and my ftp server is proftpd. The server is Ubuntu 14.04 LTS.