I need a gem for check the time and execute a piece of code only if is that time, if it execute then don't repeat still the next day, if this don't execute (because pc is off for example) then try again every certain time...I know it is very easy but I don't want reinvent the wheel and I'm pretty sure I saw someth开发者_JAVA技巧ing like this for rails..thanks
Does it have to run inside Ruby? cron
is built into Macs and Linux boxes and act-alikes are available for Windows, and can do most of what you are asking.
The ability to retry if a run is skipped is possible by storing the last-run datetime stamp and bailing if you haven't waited 24 hours or haven't passed midnight. Fire off the app hourly, have the code check the last run time and exit or continue depending on the value.
Otherwise the whenever gem might help.
精彩评论