Skip to content

Instantly share code, notes, and snippets.

@sxua
Created December 12, 2011 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sxua/1469599 to your computer and use it in GitHub Desktop.
Save sxua/1469599 to your computer and use it in GitHub Desktop.
Doesn't work after few (4-5) loops
#!/usr/bin/env ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require 'gmail'
USER_NAME = '********@gmail.com'
PASSWORD = '********'
Forever.run do
before :all do
@gmail = Gmail.new(USER_NAME, PASSWORD)
end
every 10.seconds, :at => "#{Time.now.hour}:#{Time.now.min}:#{Time.now.sec + 5}" do
unread = @gmail.inbox.count(:unread)
puts unread.inspect
unless unread.zero?
@gmail.inbox.emails(:unread).each do |email|
email.mark(:read)
puts email.subject
end
end
end
end
@DAddYE
Copy link

DAddYE commented Dec 13, 2011

Because :at will not be updated. Why you need it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment