Skip to content
Browse files

exit init.d script cleanly with message if no mailers defined in config

  • Loading branch information...
1 parent b710b38 commit 5384b022e22ceaf602310a14a430a2f7c00e48fe @adzap adzap committed Nov 11, 2008
Showing with 11 additions and 4 deletions.
  1. +4 −0 History.txt
  2. +1 −1 ar_mailer.gemspec
  3. +6 −3 share/linux/ar_sendmail
View
4 History.txt
@@ -1,3 +1,7 @@
+= 1.4.4
+
+* Exit init.d script with message if no mailers defined.
+
= 1.4.3
* Bugs fixed
View
2 ar_mailer.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{ar_mailer}
- s.version = "1.4.3"
+ s.version = "1.4.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Eric Hodel"]
View
9 share/linux/ar_sendmail
@@ -11,7 +11,11 @@ require 'yaml'
config_file = '/etc/ar_sendmail.conf'
begin
- config = YAML::load(IO.read(config_file))
+ config = YAML::load(IO.read(config_file)) || {}
+ if config.empty? || (config.has_key?('defaults') && config.size == 1)
+ puts "No mailers defined. Exiting."
+ exit
+ end
rescue Errno::ENOENT
puts "Config file not found at '#{config_file}'!"
exit
@@ -30,8 +34,7 @@ def start(app, options)
end
def stop(app, options)
- path = options['chdir']
- pid_file = File.expand_path(options['pidfile'], path)
+ pid_file = File.expand_path(options['pidfile'], options['chdir'])
if File.exist? pid_file
begin
pid = open(pid_file).read.to_i

0 comments on commit 5384b02

Please sign in to comment.
Something went wrong with that request. Please try again.