share/linux/ar_sendmail in adzap-ar_mailer-1.4.3 vs share/linux/ar_sendmail in adzap-ar_mailer-1.4.4
- old
+ new
@@ -9,11 +9,15 @@
# Config file app mailers
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
end
@@ -28,11 +32,10 @@
status = system("ar_sendmail -d #{switches}") ? "started" : "failed"
puts status
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
STDOUT.write "Stopping mailer for #{app}... "
Process.kill('TERM', pid)