Class: Foreman::Export::Monit
- Inherits:
-
Base
- Object
- Base
- Foreman::Export::Monit
show all
- Defined in:
- lib/foreman/export/monit.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#engine, #formation, #location, #options, #port
Instance Method Summary
collapse
Methods inherited from Base
#app, #initialize, #log, procfile, #template, #user
Instance Attribute Details
#check ⇒ Object
Returns the value of attribute check.
5
6
7
|
# File 'lib/foreman/export/monit.rb', line 5
def check
@check
end
|
#pid ⇒ Object
Returns the value of attribute pid.
5
6
7
|
# File 'lib/foreman/export/monit.rb', line 5
def pid
@pid
end
|
Instance Method Details
#app_check_file ⇒ Object
44
45
46
|
# File 'lib/foreman/export/monit.rb', line 44
def app_check_file
File.join(check, "#{app}.restart")
end
|
#check_file_for(name) ⇒ Object
40
41
42
|
# File 'lib/foreman/export/monit.rb', line 40
def check_file_for(name)
File.join(check, "#{app}-#{name}.restart")
end
|
#export ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/foreman/export/monit.rb', line 7
def export
super
@user ||= app
@log = File.expand_path("#{@location}/log")
@pid = File.expand_path("#{@location}/pids")
@check = File.expand_path("#{@location}/lock")
@location = File.expand_path(@location)
FileUtils.mkdir_p(@pid)
FileUtils.mkdir_p(@check)
engine.each_process do |name, process|
write_template "monit/wrapper.sh.erb", "#{app}-#{name}.sh", binding
chmod 0755, "#{app}-#{name}.sh"
`touch #{check_file_for(name)}`
end
`touch #{app_check_file}`
write_template "monit/monitrc.erb", "#{app}.monitrc", binding
end
|
#log_file_for(name, num) ⇒ Object
36
37
38
|
# File 'lib/foreman/export/monit.rb', line 36
def log_file_for(name, num)
File.join(log, "#{app}-#{name}-#{num}.log")
end
|
#pid_file_for(name, num) ⇒ Object
32
33
34
|
# File 'lib/foreman/export/monit.rb', line 32
def pid_file_for(name, num)
File.join(pid, "#{app}-#{name}-#{num}.pid")
end
|
#wrapper_path_for(name) ⇒ Object
28
29
30
|
# File 'lib/foreman/export/monit.rb', line 28
def wrapper_path_for(name)
File.join(location, "#{app}-#{name}.sh")
end
|