0kb file transferred in FTP process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 0kb file transferred in FTP process
# 1  
Old 04-18-2016
0kb file transferred in FTP process

We are transferring xml files to remote machine through cronjob @every 5 mins and then will move the files to the backup folder is source server.
Sometimes the file is transferred as 0kb to destination server, whereas the file in the source backup folder is completely written.

There is no error log recorded for the incomplete file transfer, so could you please help.
# 2  
Old 04-18-2016
Is the file creation finished when the transfer starts?
# 3  
Old 04-18-2016
See a similar thread from April first.
# 4  
Old 04-18-2016
Yes I'm using the below code to check whether the opened or not in source server.

Code:
for v_file in `ls $1`
do
echo `ls -l $v_file` >> /home/oracle/ftp/file_size
FILEUSER=`/usr/sbin/fuser $v_file | cut -d ":" -f2 > /home/oracle/ftp/fileuser_check.log `
COUNT=`cat /home/oracle/ftp/fileuser_check.log  | wc -l`
if [ $COUNT -eq 0 ];
then
mv  $1/$v_file  $3
fi
done

Could you please help to check whether the file is opened or not in remote server.


Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!

Last edited by RudiC; 04-18-2016 at 08:24 AM.. Reason: Added code tags
# 5  
Old 04-18-2016
You transferring the file from source computer to the remote computer.
But where does the file in the backup folder come from? The source computer directly, or transferred back from the remote machine?
You use the word folder instead of directory, are you aware that on Microsoft systems the output of a directory listing does not show files that are open for output, whereas Unix/Linux systems do.
# 6  
Old 04-29-2016
Hi,

The file to the backup directory is moved from the source server once the ftp is completed.
# 7  
Old 04-29-2016
Quote:
Originally Posted by Bhavi
Yes I'm using the below code to check whether the opened or not in source server.
"Not open" doen't necessarily mean "finished creating" a file. It's not uncomon that files are being opened for append in a split second, repeatedly, thus increasing in size but their writing not being reliably detectable.
Can you make sure the file is greater than 0kB in the moment of the transfer?

Quote:
Could you please help to check whether the file is opened or not in remote server.
If there is a remote chance that your destination file is "open for write" when you are transferring, you should step back and reconsider your strategy. The results of neither the file transfer nor the remote file creation will be predictable with processes competing. Even reading a file when the transfer starts will not yield reliable results.

Last edited by RudiC; 04-29-2016 at 10:42 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check whether files are transferred or not using ftp?

Hi, i want to execute a shell script which transfers files from one server to another using ftp in unix. How can i check whether the ftp is successful or not.(i.e files are transferred to destination server). because if i am checking the return code of ftp, it always shows 0 (denoting ftp is... (5 Replies)
Discussion started by: Little
5 Replies

2. Solaris

How do files transferred via ftp or sftp gets thier permissions at destination?

We have umask defined under /etc/.login as 022. I have my user specific umask defined in /userhome/.login as 002. I understand ftp will not execute anything at destination, it simply transfers files. But it seem to be using 022 as umask for the files transferred. How does ftp knows what umask... (4 Replies)
Discussion started by: kchinnam
4 Replies

3. UNIX for Dummies Questions & Answers

File SIZE 0KB help

Hi There, I need a script which shud basically check the size of the file..if its is 0kb send email to a list of people and if is > 0KB, send an email to someother list... Please help (1 Reply)
Discussion started by: saggiboy10
1 Replies

4. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

5. Shell Programming and Scripting

Validating the size of file transferred from ftp server to the local system

Validating the size of file transferred from ftp server to the local system. File type: Text file/Flat file Source System: Windows / Unix Systems Target System is always: Unix Mode of Transfer : ASCII We have generic ftp shell script that transfers the files from different ftp servers. ... (2 Replies)
Discussion started by: jpundalik
2 Replies

6. Shell Programming and Scripting

Shell script to FTP if file size is 0KB

Hi all, I was a UNIX shell script that will check for the file size of each file and it should be re directed to a text file say filesize.txt And if there are more than 10 0KB files then FTP should not happend and whenever there are less than 10 0KB files it should FTP the files. Kindly help me... (1 Reply)
Discussion started by: Codesearcher
1 Replies

7. Solaris

0KB printing files

Hi, I am dealing with strange problem... whenever we use our software to trigger some printing files, along with that it generates lot of zero KB printing files, in our code base we generate a printing file only if its size is >0. So I suspect it could be something to do with printing level... (2 Replies)
Discussion started by: vivek.gkp
2 Replies

8. Shell Programming and Scripting

How to find whether a file is transferred thro bin or ascii mode?

Hi Gurus, I need to find out, if i have transferred a file from ftp thro bin mode or ascii mode. Say if i have a file called "dec.sh"( u shuld normally transfer thro ascii mode). How can i find out that dec.sh is tranferred from ftp server thro ascii mode or bin mode? Any help would be... (9 Replies)
Discussion started by: Ashok_oct22
9 Replies

9. UNIX for Dummies Questions & Answers

Not file transferred

Hi, I'm having problems when trying to transfer multiple files from remote Pc to AS/400, using command MGET. After successfully connected to remote location and typed MGET FILE1 FILE2 FILE3 (REPLACE; I receive this message: 125 Data connection already open; Transfer starting. 226 Transfer... (3 Replies)
Discussion started by: freddyp
3 Replies

10. UNIX for Dummies Questions & Answers

Delete files with 0kb

Hi, i need to strip out a logfile dir, but only remove the files with 0kb . How would i go about doing this? TIA (3 Replies)
Discussion started by: mephisto
3 Replies
Login or Register to Ask a Question