2010-11-29 20:32:54 +00:00
|
|
|
-----
|
|
|
|
-- User configuration file for lsyncd.
|
2012-09-07 06:58:44 +00:00
|
|
|
--
|
2010-11-29 20:32:54 +00:00
|
|
|
-- While this example does not do anything it shows
|
2012-09-07 06:58:44 +00:00
|
|
|
-- how user custom alarms can be now. It will log
|
2010-11-29 20:32:54 +00:00
|
|
|
-- "Beep!" every 5 seconds.
|
|
|
|
--
|
2010-11-30 23:14:17 +00:00
|
|
|
settings.nodaemon = true
|
2010-11-29 20:32:54 +00:00
|
|
|
|
2010-11-30 23:14:17 +00:00
|
|
|
local function noAction (inlet)
|
|
|
|
-- just discard any events that happes in source dir.
|
|
|
|
inlet.discardEvent(inlet.getEvent())
|
|
|
|
end
|
2010-11-29 20:32:54 +00:00
|
|
|
|
2010-11-30 23:14:17 +00:00
|
|
|
-----
|
|
|
|
-- Adds a watch to some not so large directory for this example.
|
|
|
|
local in1 = sync{source="/usr/local/etc/", action = noAction }
|
2010-11-30 17:08:15 +00:00
|
|
|
|
2010-11-30 23:14:17 +00:00
|
|
|
local function myAlarm(timestamp, extra)
|
|
|
|
log("Normal", extra.message)
|
|
|
|
spawn(extra.inlet.createBlanketEvent(), "/bin/echo", extra.message)
|
|
|
|
alarm(timestamp + 5, myAlarm, extra)
|
|
|
|
end
|
2010-11-29 20:32:54 +00:00
|
|
|
|
2010-11-30 23:14:17 +00:00
|
|
|
alarm(now() + 5, myAlarm, {inlet = in1, message = "Beep"})
|
2010-11-29 20:32:54 +00:00
|
|
|
|