Skip to content

Instantly share code, notes, and snippets.

@seamusabshere
Created June 30, 2010 14:57
Show Gist options
  • Save seamusabshere/458758 to your computer and use it in GitHub Desktop.
Save seamusabshere/458758 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'daemon_spawn' # currently seamusabshere-daemon-spawn
# BASEDIR = '/var/www/html/offset1'
BASEDIR = '/home/vagrant/offset1'
PID_PATH = "#{BASEDIR}/daemons/offset1_imap_checker.pid"
LOG_PATH = "#{BASEDIR}/log/offset1_imap_checker.log"
TIMEOUT = 60
# SIGNAL = 'INT'
class ImapCheckerWorker < DaemonSpawn::Base
def start(args)
Dir.chdir BASEDIR
require File.expand_path('../../config/application', __FILE__)
Offset1::Application.initialize!
ImapChecker.instance.start
#
# Kernel.exec "rails runner -e production ''"
end
def stop
end
end
ImapCheckerWorker.spawn!(:log_file => LOG_PATH,
:pid_file => PID_PATH,
:sync_log => true,
:working_dir => BASEDIR,
:singleton => true,
:timeout => TIMEOUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment