Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file locking

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
Here's the deal....

/dir/A is a bucket that I shoot large JPEGS into from a camera.

I have a script running that monitors this bucket and if it sees a new jpeg file in it, it displays the jpeg onto my screen. :)

However, since the file is really large, sometimes the script tries to display the jpeg image but the jpeg hasn't completely copied over yet. Thus, only a part of the jpeg image gets displayed. :-(

How can I mitigate this? My script is a bash script and perhaps there's already a builtin command or function to help with this. Thanks for any help.
 
Why not build in a sleep cycle? Once your script finds the file, have it sleep for 2 or 3 minutes (or whatever is appropriate for the file to finish copying) and then proceed.
 
My script is setup to display an image every 6 seconds. If not a new jpeg is present in the "bucket", it displays "the next jpeg in line". This 6 seconds is enough time for a large jpeg to transfer over, BUT, we're using wireless networking and sometimes latency prevents the jpeg to copy over before the 6 seconds time period is up. The script "sees" a new filename in the "bucket" and assumes that it's ready to be displayed.

Increasing the 6 second time period isn't an option.

 
How about using the 'fuser' command to see if the file is in use by another process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top