Handle Maintenance Tasks for Rails Apps without Cron
It checks for an existing process and if it doesn't find one, spawns a new thread to handle maintenance tasks.
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