troubleshooting Question

How to tell if a File is still being written too

Avatar of Greg Duffin
Greg DuffinFlag for United States of America asked on
Unix OS
12 Comments1 Solution459 ViewsLast Modified:
I have a program that is started by a user at anytime during the work day. That program once started creates a file and continues to write to that file until its done.  I have a script that runs every 5 minutes looking for this file and ftps it to another server.  The problem is that sometimes this program takes a long time (15-30 minutes) to complete and the file (since the program initally creates it) is ftped over even though the program is still writing to it and the user has an incomplete file.  Is there a way to tell when the file is complete before the ftp process works.  So basically it would be if file is being written to do not ftp over.  If that is not possibel I though of comparing the last modification time of the file to the system time and if the modification time is older than 30 minutes then ftp the file if not do nothing. In both possible solutions I would need assitance on how to write it.

I am running Solaris 10 06/06
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros