Class: Sunshine::ARSendmail

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

Overview

Simple daemon wrapper for ar_sendmail setup and control. By default, uses server apps with the :mail role.

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 = {}) ⇒ ARSendmail

Returns a new instance of ARSendmail.



9
10
11
12
13
14
15
# File 'lib/sunshine/daemons/ar_sendmail.rb', line 9

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

  super app, options

  @dep_name = options[:dep_name] || 'ar_mailer'
end

Instance Method Details

#start_cmdObject



18
19
20
# File 'lib/sunshine/daemons/ar_sendmail.rb', line 18

def start_cmd
  "cd #{@app.current_path} && #{@bin} -p #{@pid} -d"
end

#stop_cmdObject



23
24
25
26
# File 'lib/sunshine/daemons/ar_sendmail.rb', line 23

def stop_cmd
  "test -f #{@pid} && kill `cat #{@pid}` || "+
    "echo 'No #{@name} process to stop for #{@app.name}'; rm -f #{@pid};"
end