Class: Sunshine::DelayedJob

Inherits:
Daemon
  • Object
show all
Defined in:
lib/sunshine/daemons/delayed_job.rb

Overview

Simple daemon wrapper for delayed_job daemon setup and control. By default, uses server apps with the :dj role. Supports the :processes option.

Instance Attribute Summary

Attributes inherited from Daemon

#app, #bin, #config_file, #config_path, #config_template, #name, #pid, #processes, #restart_cmd, #server_apps, #status_cmd, #sudo, #target, #timeout

Instance Method Summary collapse

Methods inherited from Daemon

binder_methods, #config_file_path, #config_template_files, #each_server_app, #has_setup?, #log_file, #log_files, #restart, #setup, #start, #stop, underscore, #upload_config_files

Constructor Details

#initialize(app, options = {}) ⇒ DelayedJob

Returns a new instance of DelayedJob.



10
11
12
13
14
15
16
17
18
# File 'lib/sunshine/daemons/delayed_job.rb', line 10

def initialize app, options={}
  options[:role] ||= :dj

  super app, options

  @pid = "#{@app.current_path}/tmp/pids/delayed_job.pid"

  @dep_name = options[:dep_name] || "daemons"
end

Instance Method Details

#start_cmdObject



21
22
23
# File 'lib/sunshine/daemons/delayed_job.rb', line 21

def start_cmd
  "cd #{@app.current_path} && script/delayed_job -n #{@processes} start"
end

#stop_cmdObject



26
27
28
# File 'lib/sunshine/daemons/delayed_job.rb', line 26

def stop_cmd
  "cd #{@app.current_path} && script/delayed_job stop"
end