Hey all,
So I have a script that runs pretty much every 5 minutes or so to look for updated files locally on a server. New files (ranging in size from 1KB - 2MB) are then FTP'd to another server. Without going into detail, one server is a content server, the other is a 'broadcast' server. Anywho, the problem seems to be with the FTP part. I'd say about 20 percent of the time, regardless of file size, something hangs up, such that the file is never delivered completely from the content server to the broadcast server. What's worse, about 5% the incomplete files get locked up. I've ensured there isn't a time out issue with the script, and I admit the Internet connection between the servers isn't great. (One server is in the US, and the other in S. Africa.) Anyway, I've tried my best, but is there a reliable way to verify a file is completely uploaded and not 'corrupted' or incomplete? When I return '$result' from the fput action, I don't get any errors reported -- even when I can visually see the file is incomplete or locked. The only thing I can think is to download the file after uploading and do a byte-by-byte comparison, but that seems a rather ugly and bandwidth/processor taxing method. Thanks in advance for any help. Alternatively, maybe I shouldn't be using PHP for this -- so other suggestions?
So I have a script that runs pretty much every 5 minutes or so to look for updated files locally on a server. New files (ranging in size from 1KB - 2MB) are then FTP'd to another server. Without going into detail, one server is a content server, the other is a 'broadcast' server. Anywho, the problem seems to be with the FTP part. I'd say about 20 percent of the time, regardless of file size, something hangs up, such that the file is never delivered completely from the content server to the broadcast server. What's worse, about 5% the incomplete files get locked up. I've ensured there isn't a time out issue with the script, and I admit the Internet connection between the servers isn't great. (One server is in the US, and the other in S. Africa.) Anyway, I've tried my best, but is there a reliable way to verify a file is completely uploaded and not 'corrupted' or incomplete? When I return '$result' from the fput action, I don't get any errors reported -- even when I can visually see the file is incomplete or locked. The only thing I can think is to download the file after uploading and do a byte-by-byte comparison, but that seems a rather ugly and bandwidth/processor taxing method. Thanks in advance for any help. Alternatively, maybe I shouldn't be using PHP for this -- so other suggestions?
Comment