Class: Services
- Inherits:
-
Object
- Object
- Services
- Defined in:
- lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb
Instance Method Summary collapse
-
#initialize ⇒ Services
constructor
A new instance of Services.
- #start ⇒ Object
- #stop(signo) ⇒ Object
Constructor Details
#initialize ⇒ Services
Returns a new instance of Services.
7 8 9 |
# File 'lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb', line 7 def initialize @services = %w(rsyslog haproxy spamassassin spamassassin.update opendkim postfix dovecot) end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb', line 11 def start puts "Starting Services..." @services.each { |service| system("monit start #{service}") } system("monit") puts "Starting Logtailer..." system("/usr/bin/logtailer.rb start") end |
#stop(signo) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb', line 20 def stop(signo) puts "Stopping Logtailer..." system("/usr/bin/logtailer.rb stop") puts "Stopping Services... SIGNAL: SIG#{Signal.signame(signo)}." system("monit quit") sleep(3) @services.reverse.each { |service| system("monit stop #{service}") } puts "Flushing Logtailer..." system("/usr/bin/logtailer.rb flush") exit end |