Wes Gamble
2006-Nov-28 23:42 UTC
Is there any built-in auto-cleanup of the "tmp" directory?
I need to generate some files that I only need for the duration of a user''s session. If I create these files in the Rails "tmp" directory, is there any automagic process that will periodically clean out the "tmp" directory, or is that something that I would have to manage myself? Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2006-Nov-29 00:51 UTC
Re: Is there any built-in auto-cleanup of the "tmp" directory?
> I need to generate some files that I only need for the duration of a > user''s session. > > If I create these files in the Rails "tmp" directory, is there any > automagic process that will periodically clean out the "tmp" directory, > or is that something that I would have to manage myself?rake tmp:cache:clear # Clears all files and directories in tmp/cache rake tmp:clear # Clear session, cache, and socket files from tmp/ rake tmp:create # Creates tmp directories for sessions, cache, and sockets rake tmp:sessions:clear # Clears all files in tmp/sessions rake tmp:sockets:clear # Clears all files in tmp/sockets Add one or more of those to your crontab file and that should do it for you... -philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Justin Mazzi
2006-Nov-29 03:47 UTC
Re: Is there any built-in auto-cleanup of the "tmp" director
Philip Hallstrom wrote:>> I need to generate some files that I only need for the duration of a >> user''s session. >> >> If I create these files in the Rails "tmp" directory, is there any >> automagic process that will periodically clean out the "tmp" directory, >> or is that something that I would have to manage myself? > > rake tmp:cache:clear # Clears all files and directories > in tmp/cache > rake tmp:clear # Clear session, cache, and socket > files from tmp/ > rake tmp:create # Creates tmp directories for > sessions, cache, and sockets > rake tmp:sessions:clear # Clears all files in tmp/sessions > rake tmp:sockets:clear # Clears all files in tmp/sockets > > Add one or more of those to your crontab file and that should do it for > you... > > -philipKeep in mind, clearing sessions will kill all active sessions to. I don''t recommend that. You could create a model called: PeriodicNightly with something like this in it: def self.run CGI::Session::ActiveRecordStore::Session. destroy_all( [''updated_at <?'', 48.hours.ago] ) end then cron your script/runner like this script/runner -e production PeriodicNightly.run -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Wes Gamble
2006-Nov-29 03:59 UTC
Re: Is there any built-in auto-cleanup of the "tmp" director
Actually, I''m not interested in killing sessions. I wanted to know if I created my own directory under tmp, say "wes", would there ever by any automatic cleanup of that directory. It appears there isn''t so that I would have to manage it by hand. Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Wes Gamble wrote:> > Actually, I''m not interested in killing sessions. > > I wanted to know if I created my own directory under tmp, say "wes", > would there ever by any automatic cleanup of that directory. > > It appears there isn''t so that I would have to manage it by hand. >If you are on Linux/Unix you can write a sh script to rm /path/to/wes/* and run it under cron. Just a thought, Long www.edgesoft.ca/blog/read/2 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---