2010-11-29 20:32:54 +00:00
|
|
|
-----
|
|
|
|
-- User configuration file for lsyncd.
|
|
|
|
--
|
|
|
|
-- While this example does not do anything it shows
|
|
|
|
-- how user custom alarms can be now. It will log
|
|
|
|
-- "Beep!" every 5 seconds.
|
|
|
|
--
|
|
|
|
|
2010-11-30 17:08:15 +00:00
|
|
|
lalarm = {
|
|
|
|
init = function(inlet)
|
|
|
|
-- creates the first alarm in 5 seconds from now.
|
|
|
|
inlet.alarm(now() + 5, "Beep")
|
|
|
|
end,
|
2010-11-29 20:32:54 +00:00
|
|
|
|
2010-11-30 17:08:15 +00:00
|
|
|
-- called when alarms ring
|
|
|
|
alarm = function(inlet, timestamp, extra)
|
|
|
|
log("Normal", extra)
|
|
|
|
|
|
|
|
spawn(inlet.createBlanketEvent(), "/bin/echo", "hello")
|
|
|
|
-- creates a new alarm in 5 seconds after this one rang
|
|
|
|
inlet.alarm(timestamp + 5, extra)
|
|
|
|
end,
|
|
|
|
|
|
|
|
action = function(inlet)
|
|
|
|
-- just discard anything that happes in source dir.
|
|
|
|
inlet.discardEvent(inlet.getEvent())
|
|
|
|
end
|
|
|
|
}
|
2010-11-29 20:32:54 +00:00
|
|
|
|
|
|
|
-----
|
2010-11-30 17:08:15 +00:00
|
|
|
-- Lsyncd needs to watch something, altough in this minimal example
|
|
|
|
-- it isnt used.
|
|
|
|
sync{source="/usr/local/etc/", lalarm }
|
2010-11-29 20:32:54 +00:00
|
|
|
|