mysql_health 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -147,12 +147,6 @@ module MysqlHealth
|
|
147
147
|
@log = Logger.new(@options[:log][:file], @options[:log][:age], @options[:log][:size])
|
148
148
|
@log.level = @options[:log][:level]
|
149
149
|
|
150
|
-
daemonize if @options[:server][:daemonize]
|
151
|
-
write_pid_file if @options[:server][:pid_file]
|
152
|
-
|
153
|
-
MysqlHealth.log = @log
|
154
|
-
MysqlHealth.health = Health.new(@options[:check])
|
155
|
-
|
156
150
|
rescue ArgumentException => e
|
157
151
|
puts e.message
|
158
152
|
puts @optparse
|
@@ -182,16 +176,30 @@ module MysqlHealth
|
|
182
176
|
end
|
183
177
|
end
|
184
178
|
|
179
|
+
def remove_pid_file
|
180
|
+
File.unlink(@options[:server][:pid_file]) if @options[:server][:pid_file] && File.exists?(@options[:server][:pid_file])
|
181
|
+
end
|
182
|
+
|
185
183
|
def execute
|
186
184
|
begin
|
185
|
+
daemonize if @options[:server][:daemonize]
|
186
|
+
write_pid_file if @options[:server][:pid_file]
|
187
|
+
|
188
|
+
MysqlHealth.log = @log
|
189
|
+
MysqlHealth.health = Health.new(@options[:check])
|
190
|
+
|
187
191
|
::EM.run do
|
188
192
|
::EM.start_server @options[:server][:listen], @options[:server][:port], Server
|
189
193
|
end
|
194
|
+
remove_pid_file()
|
190
195
|
rescue ArgumentException => e
|
196
|
+
remove_pid_file()
|
191
197
|
@log.fatal(e.message)
|
192
198
|
rescue Interrupt => e
|
199
|
+
remove_pid_file()
|
193
200
|
@log.info("exiting...")
|
194
201
|
rescue Exception => e
|
202
|
+
remove_pid_file()
|
195
203
|
@log.fatal(e.message + e.backtrace.join("\n"))
|
196
204
|
end
|
197
205
|
end
|
data/lib/mysql_health/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
2
2
|
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
3
3
|
%define gemname mysql_health
|
4
|
-
%define gemversion 0.5.
|
4
|
+
%define gemversion 0.5.4
|
5
5
|
%define geminstdir %{gemdir}/gems/%{gemname}-%{gemversion}
|
6
6
|
%define gemfile %{gemname}-%{gemversion}.gem
|
7
7
|
%define gemsummary %(ruby -rrubygems -e 'puts YAML.load(`gem specification %{gemfile}`).summary')
|
@@ -66,7 +66,7 @@ rm -rf %{buildroot}
|
|
66
66
|
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
67
67
|
%{_initrddir}/%{gemname}
|
68
68
|
%{_sysconfdir}/%{gemname}/
|
69
|
-
%{_sysconfdir}/sysconfig/%{gemname}
|
69
|
+
%config(noreplace) %{_sysconfdir}/sysconfig/%{gemname}
|
70
70
|
|
71
71
|
%changelog
|
72
72
|
* Sun Jul 29 2012 Erik Osterman <e@osterman.com>
|