DNBrennan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-28 19:07 UTC
How do I know when a file is fully created
Hi, I have a rails app, that lets user submit data. I use the data to tell another app to create a file. I can''t get this app to tell me when it is finished with the file. So is there any way in Rails to check if another app is writing to a file? Kind regards, Dave. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I have a rails app, that lets user submit data. I use the data to tell > another app to create a file. I can''t get this app to tell me when it > is finished with the file. So is there any way in Rails to check if > another app is writing to a file?There''s probably a way... the unix command lsof will report that sort of thing to you, but to check on files you don''t own requires you to be root. So maybe not. I had to do something similar, but for remote web files. I ended up making HEAD requests and comparing the file size over a period of time. Once it stopped changing I''d consider the file ready. You maybe could do something similar. Or change the process so your second app doesn''t see the file until it''s ready. That is, first app writes out "file.tmp" and at the very end moves it to "file" and second app only looks for "file" or something. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---