24 lines
595 B
Ruby
24 lines
595 B
Ruby
|
#!/usr/bin/env ruby
|
||
|
|
||
|
require 'rubygems'
|
||
|
require 'rufus-scheduler'
|
||
|
|
||
|
#users = User.where("mail_notification = 'week' or mail_notification = 'day'")
|
||
|
|
||
|
scheduler = Rufus::Scheduler.new
|
||
|
scheduler.cron('*/1 * * * *') do
|
||
|
users = User.where("login like '%alan%'")
|
||
|
users.each do |user|
|
||
|
# if user.mail_notification == "week"
|
||
|
# cycle = '*/1 * * * *'
|
||
|
# else
|
||
|
# cycle = '*/2 * * * *'
|
||
|
# end
|
||
|
Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
|
||
|
Thread.start do
|
||
|
Mailer.send_for_user_activities(user, Date.today, 7).deliver
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|