Class: MalmCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
bin/malm

Instance Method Summary collapse

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'bin/malm', line 20

def execute    
  malm_proc = proc{
    malm = Malm::Main.new(:log => log, :smtpport => smtpport, :webport => webport)
    malm.run!      
  }
  
  if start? || stop? || restart?
    mode = nil
    mode ||= start? ? "start" : nil
    mode ||= stop? ? "stop" : nil
    mode ||= restart? ? "restart" : nil

    daemon_options = {
      :ARGV => [mode],
      :dir_mode => :normal,
      :dir => piddir,
      :multiple => true,
      :monitor => true,
      :app_name => "malm-#{smtpport}-#{webport}"
    }
    
    Daemons.run_proc("malm-#{smtpport}-#{webport}", daemon_options, &malm_proc)
  else
    malm_proc.call
  end
end