Sha256: 3deacebe6f6748cbd45d3a67459f2a84599ef8040a5cb811a018d188bb045005

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

namespace :backgroundjob do
  
  namespace :centos do
    
    desc <<-DESC
    Setup backgroundjob for application.
    
    <dl>
    <dt>backgroundjob_bin_path</dt>
    <dd>Path to start.
    <dd class="default">Defaults to: 
    <pre>
      \#{current_path}/script/bj --forever --rails_env=production --rails_root=\#{current_path} --redirect \
      --redirect=\#{backgroundjob_log_path} --pidfile=\#{backgroundjob_pid_path} &
    </pre>
    </dd>
    <dt>backgroundjob_pid_path</dt>
    <dd>Path to backgroundjob pid file</dd>
    <dd class="default">Defaults to @\#{shared_path}/pids/bj.pid@</dd>
    
    <dt>backgroundjob_log_path</dt>
    <dd>Path to backgroundjob log file</dd>
    <dd class="default">Defaults to @\#{shared_path}/logs/bj.log@</dd>
    </dl>
    "Source":#{link_to_source(__FILE__)}
    DESC
    task :setup do       
      # Settings
      fetch_or_default(:backgroundjob_pid_path, "#{shared_path}/pids/bj.pid")
      fetch_or_default(:backgroundjob_log_path, "#{shared_path}/log/bj.log")
      
      default_bin_path = "#{current_path}/script/bj run --forever --rails_env=production --rails_root=#{current_path} \
--redirect=#{backgroundjob_log_path} --pidfile=#{backgroundjob_pid_path} &"
      
      fetch_or_default(:backgroundjob_bin_path, default_bin_path)
      

      # Install initscript      
      utils.install_template("backgroundjob/backgroundjob.initd.centos.erb", "/etc/init.d/backgroundjob_#{application}")

      # Enable service
      run_via "/sbin/chkconfig --level 345 backgroundjob_#{application} on"    
      
    end
    
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
capitate-0.3.1 lib/recipes/centos/backgroundjob.rb
capitate-0.3.3 lib/recipes/centos/backgroundjob.rb
capitate-0.3.5 lib/recipes/centos/backgroundjob.rb
capitate-0.3.2 lib/recipes/centos/backgroundjob.rb
capitate-0.3.4 lib/recipes/centos/backgroundjob.rb