I have a process which generates a file and places it on my sftp server
Then I connect to the sftp to retrieve the file. However for some reason, I keep getting an incomplete file.
These are the steps.
Submit a request to my sftp file to start generating a file
That file is picked up processed on a backend server and the output is placed back on the sftp server
Meanwhile my script keeps running frequently to check if the output file is present.
Once present it picks up the file
For some reason my process is picking up an incomplete file. Its like picking up the file whilst the output is getting transfered on the sftp server from the backend server.
Let's take for granted that sftp works flawlessly. So the problem must be somewhere else. If you say for sure the file is completely created, what are the differences that you find? Lines missing? At the end? other? Please post.
Only half the data is retrieved whereas on the sftp server, the entire file is present. I know that the entire file is present, because I compare the timestamp of the completed file on the sftp server, with the timestamp of my scripts pull. They match.
The data is missing towards end of the file. There are some garbage characters.
Have the process that puts the file on the sftp server put 2 files.
put april_2_0900.dat
put april_2_0900.job
On the retrieving machine, get *.job files first.
Then from the job files retrieved create a job to get a specific list of .dat files.
When the .dat files are successfully processed, delete all those .job files on the server.
The .job file can contain any minimal amount of data.