From: Robert Klemme Date: 2005-11-21T21:42:24+09:00 Subject: Re: url-monitoring script question Damphyr wrote: > Torsten Schmidt wrote: >> Thanks for the input so far. >> >> another possible solution come to my (ruby-beginner) mind instead of >> writing the status-code to a seperate file and parse it: >> >> some kind of deamon-process: what about to put something like 'sleep >> 300' in the script to make an indefinetly loop. so it's easier to >> store the exit-code of the http-requests and compare them. >> >> with this it would be possible to send 5 error-emails (25 min) and >> after that, send another email when the url 'recovers'. >> >> What are your opinions for that solution? > What you can also do is hold the state in a simple class: > class SiteState > def initialize > @errors=Array.new > @notified=false > ... > end > ... > end > and just use Marshal to dump the class in a file between calls to the > script. > It's the easiest way to persist information and you don't need to come > up with a file structure and parse code (even if it is trivial) > Cheers, Right. But it doesn't necessarily need to be inside a single special class. A hash might do as well. Kind regards robert