Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Maintenance Of Rails Programs

DZone's Guide to

Maintenance Of Rails Programs

·
Free Resource
This is a maintenance script, yanked from Lucas Carlson's blog.  Put this in your rails app to have a quick and dirty server maintenance cleanup app:

original at: http://tech.rufy.com/entry/15


pid_file = '/tmp/running.pid'
begin
  File.stat pid_file
rescue
  f = File.new pid_file, 'w'
  f < < fork {
    loop {
      # do lots of maintenance
      sleep 15*60
    }
  }
  f.close
end


Finally, if your maintenance code needs to be changed, a couple simple commands can restart the new maintenance code:


kill `cat /tmp/running.pid`
rm /tmp/running.pid
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}