mailing from crontab
This commit is contained in:
@@ -4,5 +4,5 @@
|
|||||||
source /usr/local/rvm/environments/ruby-1.9.3-p125@smartmeter
|
source /usr/local/rvm/environments/ruby-1.9.3-p125@smartmeter
|
||||||
|
|
||||||
cd /mnt/usb/ruby/smartmeter
|
cd /mnt/usb/ruby/smartmeter
|
||||||
ruby test-serial.rb
|
ruby report_mailer.rb
|
||||||
|
|
||||||
|
|||||||
16
report_mailer.rb
Normal file
16
report_mailer.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
require "active_record"
|
||||||
|
require "state_pattern"
|
||||||
|
|
||||||
|
project_root = File.dirname(File.absolute_path(__FILE__))
|
||||||
|
Dir.glob(project_root + "/app/models/*.rb").each{|f| require f}
|
||||||
|
Dir.glob(project_root + "/app/helpers/*.rb").each{|f| require f}
|
||||||
|
|
||||||
|
connection_details = YAML::load(File.open('config/database.yml'))
|
||||||
|
ActiveRecord::Base.establish_connection(connection_details)
|
||||||
|
|
||||||
|
if __FILE__ == $0
|
||||||
|
ReadingsMailer.deliver
|
||||||
|
end
|
||||||
|
#p sync
|
||||||
Reference in New Issue
Block a user