I have been writing some rails apps recently. Here are some of the things I have encountered.
Here is one from my brother-in-law, the famous Tim Morgan http://snippets.dzone.com/posts/show/2594Here is one I made for my use with delayed_job, http://github.com/jrichter/delayed_job/tree/master/lib/delayed/worker_startup_scriptIn a ruby startup script the shebang line should be #!/usr/bin/env ruby To load a rails environment and get rake support make sure to include:
app_dir = '/path/to/rails/app'
require(File.join(app_dir, 'config', 'boot'))
Then if you need to run a rake task, such as db:migrate:
system "/usr/bin/ruby /usr/bin/rake -f #{app_dir}/Rakefile db:migrate &"