Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to know when a file is finish writing

Posted on 2000-02-15
9
Medium Priority
?
291 Views
Last Modified: 2010-04-21
I have a software that generate files
in /disk1 directory;  I want to write
a shell script which
to move all complete files from
/disk1 to /disk2;  don't move the file
that is still growing, or in the process of creating.


thanks
0
Comment
Question by:nngdemi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 2525235
How does your software generate the files?
0
 
LVL 12

Expert Comment

by:tel2
ID: 2525606
nngdemi,

If you issue the command:
  fuser <filename>
and it DOESN'T list any processes numbers next to the filename, then the file SHOULD be finished growing (as long as your software keeps the file "open" all the time until it's finised writing to it, which would usually be the case).

If you want help to automate the above as a cron job, then give us some example directory and file names and we might write a script for you.
0
 

Expert Comment

by:purkar_san
ID: 2526322
Hi ozo
How you come know that, your software has released that file and you want to move to other area? Moving file from one area to another area is not big stuff. As suggested by tel2, that can done by cron. But for that you have to give some idea about, at what condition you want to move file.  On size basis or on creation date or something else. Some logic must be there.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:nngdemi
ID: 2528034
This question has a deletion request Pending
0
 
LVL 12

Expert Comment

by:tel2
ID: 2528633
This question no longer is pending deletion
0
 
LVL 12

Accepted Solution

by:
tel2 earned 300 total points
ID: 2528634
nngdemi,

I see you trying to delete this question.
Any problems with the following solution, which I am posting again, as an Answer this time?

If you issue the command:
  fuser <filename>
and it DOESN'T list any processes numbers next to the filename, then the file SHOULD be finished growing (as long as your software keeps the file "open" all the time until it's finised writing to it, which would usually be the case).

If you want help to automate the above as a cron job, then give us some example directory and file names and we might write a script for you.
 
0
 

Author Comment

by:nngdemi
ID: 2532650
thanks tel2,
   I no longer need to do this
anymore.

Thanks again for the help.
0
 
LVL 12

Expert Comment

by:tel2
ID: 2532832
nngdemi,

OK, but you asked the question, I went to the trouble of answering it less than 4 hours later, so I think, whether you still want it or not, you should either accept my answer and give me the points, or reject it and tell me what's wrong with it.

It's like you asked for a job to be done and offered a price, and then someone did the job and you didn't pay.

Otherwise, everyone could just post questions, and when they get the answer they want they could just say they don't it anymore.  Pretty soon, no one would bother answering questions.

Sound fair?  What do you think?
0
 
LVL 2

Expert Comment

by:GP1628
ID: 2555073
for others................ old military answer. easy to use in any program on any machine.

Use a GO file.
have the program creating the files create one more file at the end. Something like GO.txt

Have the transfer program watch or test for GO.txt and when it appears it can begin downloading the other files which will all be done.

Even if it reaches GO.txt while it is still being written (unlikely since it would be like a 1byte file) it wouldnt matter since its a junk file that you dont care about.

Delete GO.txt when you are done and put the script back to watching for another GO.txt to appear

Gandalf
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question