Skip to content

Instantly share code, notes, and snippets.

@r38y
Created August 6, 2008 18:48
Show Gist options
  • Save r38y/4253 to your computer and use it in GitHub Desktop.
Save r38y/4253 to your computer and use it in GitHub Desktop.
RAILS_ROOT = '/var/www/apps/fetcher/production/current'
FETCHER_SCRIPT = "#{RAILS_ROOT}/script/email_fetcher"
God.watch do |w|
w.name = "fetcher-daemon"
w.uid = 'deploy'
w.gid = 'users'
w.interval = 30.seconds
w.start = "RAILS_ENV=production #{FETCHER_SCRIPT} start &"
w.stop = "RAILS_ENV=production #{FETCHER_SCRIPT} stop &"
w.restart = "RAILS_ENV=production #{FETCHER_SCRIPT} restart &"
w.grace = 10.seconds
w.pid_file = File.join(RAILS_ROOT, 'log', 'EmailFetcherDaemon.pid')
w.behavior(:clean_pid_file)
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment