Bret,
Thanks for sharing, we appreciate it!
-MC

On Fri, Oct 23, 2009 at 11:43 AM, Trixter aka Bret McDanel <trixter@0xdecafbad.com> wrote:
for anyone that is interested, in
<SRC>/contrib/trixter/scheduled_event.lua there is a script, which
admittedly is not very well tested (written last night) that allows for
mysql events to be scheduled to be run.

Why mysql and not sched_api or similar?  Well this allows the scheduled
events to survive past a reboot, shutdown, crash, alien abduction, or
other issue.  It also is written in a way to allow for many switches to
each pull an event off one at a time and process them, thus distributing
the load.  sched_api requires that the scheduled event exist on a
particular switch which can be a bit messy in some applications.

So you can do a "hotel style wake up call" (good for getting out of
boring meetings or bad blind dates) or really anything you want.

You can start/stop the script, even change the DB credentials without a
restart to allow for easier load management or maintenance.

Its a trivial script, but I didnt see anything like this elsewhere.  If
people have specific feature requests (like adding a machine column to
the table so that certain events can be scheduled only for specific
machines, or only pulling events when the load is under X) let me know
and I will look into doing that.

The only problem that I saw last night was that it runs every
"heartbeat" (FS eventing system) and if you have more tasks to
accomplish in a given interval it can get a little backlogged and does
not do any notification to that effect.


--
Trixter http://www.0xdecafbad.com     Bret McDanel
pgp key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8AE5C721