removing extra linespaces, comment cleanup

This commit is contained in:
Axel Kittenberger 2012-09-07 08:58:44 +02:00
parent f50be8e51b
commit 9106f81c4a
9 changed files with 53 additions and 53 deletions

View File

@ -1,8 +1,8 @@
----- -----
-- User configuration file for lsyncd. -- User configuration file for lsyncd.
-- --
-- While this example does not do anything it shows -- While this example does not do anything it shows
-- how user custom alarms can be now. It will log -- how user custom alarms can be now. It will log
-- "Beep!" every 5 seconds. -- "Beep!" every 5 seconds.
-- --
settings.nodaemon = true settings.nodaemon = true

View File

@ -1,7 +1,7 @@
----- -----
-- User configuration file for lsyncd. -- User configuration file for lsyncd.
-- --
-- This example uses local bash commands to keep two local -- This example uses local bash commands to keep two local
-- directory trees in sync. -- directory trees in sync.
-- --
settings = { settings = {
@ -28,16 +28,16 @@ bash = {
-- calls `cp -r SOURCE/* TARGET` only when there is something in SOURCE -- calls `cp -r SOURCE/* TARGET` only when there is something in SOURCE
-- otherwise it deletes contents in the target if there. -- otherwise it deletes contents in the target if there.
onStartup = [[ onStartup = [[
if [ "$(ls -A ^source)" ]; then if [ "$(ls -A ^source)" ]; then
cp -r ^source* ^target; cp -r ^source* ^target;
else else
if [ "$(ls -A ^target)" ]; then rm -rf ^target/*; fi if [ "$(ls -A ^target)" ]; then rm -rf ^target/*; fi
fi]], fi]],
onCreate = prefix..[[cp -r ^sourcePath ^targetPathdir]], onCreate = prefix..[[cp -r ^sourcePath ^targetPathdir]],
onModify = prefix..[[cp -r ^sourcePath ^targetPathdir]], onModify = prefix..[[cp -r ^sourcePath ^targetPathdir]],
onDelete = prefix..[[rm -rf ^targetPath]], onDelete = prefix..[[rm -rf ^targetPath]],
onMove = prefix..[[mv ^o.targetPath ^d.targetPath]], onMove = prefix..[[mv ^o.targetPath ^d.targetPath]],

View File

@ -1,7 +1,7 @@
----- -----
-- User configuration file for lsyncd. -- User configuration file for lsyncd.
-- --
-- This example uses local bash commands to keep two local -- This example uses local bash commands to keep two local
-- directory trees in sync. -- directory trees in sync.
-- --
@ -11,7 +11,7 @@
echo = { echo = {
maxProcesses = 1, maxProcesses = 1,
delay = 1, delay = 1,
onStartup = "/bin/echo telling about ^source", onStartup = "/bin/echo telling about ^source",
onAttrib = "/bin/echo attrib ^pathname", onAttrib = "/bin/echo attrib ^pathname",
onCreate = "/bin/echo create ^pathname", onCreate = "/bin/echo create ^pathname",
onDelete = "/bin/echo delete ^pathname", onDelete = "/bin/echo delete ^pathname",

View File

@ -1,8 +1,8 @@
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- lftp.lua -- User configuration file for lsyncd.
--
-- Syncs with 'lftp'.
-- --
-- Syncs with lftp
-- A (Layer 1) configuration.
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lftp = { lftp = {

View File

@ -1,22 +1,22 @@
----- -----
-- User configuration file for lsyncd. -- User configuration file for lsyncd.
-- --
-- This example refers to a common problem in unix. -- This example refers to one common challenge in multiuser unix systems.
-- --
-- You have a shared directory for a set of users and you want -- You have a shared directory for a set of users and you want
-- to ensure all users have read and write permissions on all -- to ensure all users have read and write permissions on all
-- files in there. Unfortunally sometimes users mess with their -- files in there. Unfortunally sometimes users mess with their
-- umask, and create files in there that are not read/write/deleteable -- umask, and create files in there that are not read/write/deleteable
-- by others. Usually this involves frequent handfixes by a sysadmin, -- by others. Usually this involves frequent handfixes by a sysadmin,
-- or a cron job that recursively chmods/chowns the whole directory. -- or a cron job that recursively chmods/chowns the whole directory.
-- --
-- This is another approach to use lsyncd to continously fix permissions. -- This is another approach to use lsyncd to continously fix permissions.
-- --
-- One second after a file is created/modified it checks for its permissions -- One second after a file is created/modified it checks for its permissions
-- and forces group permissions on it. -- and forces group permissions on it.
-- --
-- This example regards more the handcraft of bash scripting than lsyncd. -- This example regards more the handcraft of bash scripting than lsyncd.
-- An alternative to this would be to load a Lua-Posix library and do the -- An alternative to this would be to load a Lua-Posix library and do the
-- permission changes right within the onAction handlers. -- permission changes right within the onAction handlers.
---- ----
@ -27,29 +27,29 @@ fgroup = "staff"
----- -----
-- script for all changes. -- script for all changes.
-- --
command = command =
-- checks if the group is the one enforced and sets them if not -- checks if the group is the one enforced and sets them if not
[[ [[
perm=`stat -c %A ^sourcePathname` perm=`stat -c %A ^sourcePathname`
if [ `stat -c %G ^sourcePathname` != ]]..fgroup..[[ ]; then if [ `stat -c %G ^sourcePathname` != ]]..fgroup..[[ ]; then
/bin/chgrp ]]..fgroup..[[ ^sourcePathname || /bin/true; /bin/chgrp ]]..fgroup..[[ ^sourcePathname || /bin/true;
fi fi
]] .. ]] ..
-- checks if the group permissions are rw and sets them -- checks if the group permissions are rw and sets them
[[ [[
if [ `expr match $perm "....rw"` == 0 ]; then if [ `expr match $perm "....rw"` == 0 ]; then
/bin/chmod g+rw ^sourcePathname || /bin/true; /bin/chmod g+rw ^sourcePathname || /bin/true;
fi fi
]] .. ]] ..
-- and forces the executable bit for directories. -- and forces the executable bit for directories.
[[ [[
if [ -d ^sourcePathname ]; then if [ -d ^sourcePathname ]; then
if [ `expr match $perm "......x"` == 0 ]; then if [ `expr match $perm "......x"` == 0 ]; then
/bin/chmod g+x ^^sourcePathname || /bin/true; /bin/chmod g+x ^^sourcePathname || /bin/true;
fi fi
fi fi
]] ]]
-- on startup recursevily sets all group ownerships -- on startup recursevily sets all group ownerships
@ -58,11 +58,11 @@ fi
-- --
-- the carret as first char tells Lsycnd to call a shell altough it -- the carret as first char tells Lsycnd to call a shell altough it
-- starts with a slash otherwisw -- starts with a slash otherwisw
-- --
startup = startup =
[[^/bin/chgrp -R ]]..fgroup..[[ ^source || /bin/true && [[^/bin/chgrp -R ]]..fgroup..[[ ^source || /bin/true &&
/bin/chmod -R g+rw ^source || /bin/true && /bin/chmod -R g+rw ^source || /bin/true &&
/usr/bin/find ^source -type d | xargs chmod g+x /usr/bin/find ^source -type d | xargs chmod g+x
]] ]]
gforce = { gforce = {

View File

@ -1,6 +1,6 @@
---- ----
-- Lsyncd user-script that creates a "magic" image converter directory. -- Lsyncd user-script that creates a "magic" image converter directory.
-- --
-- This configuration will automatically convert all images that are placed -- This configuration will automatically convert all images that are placed
-- in the directory 'magicdir' all resulting images are placed in the same -- in the directory 'magicdir' all resulting images are placed in the same
-- directory! -- directory!
@ -50,7 +50,7 @@ convert = {
if cmd ~= "" then if cmd ~= "" then
cmd = cmd .. " && " cmd = cmd .. " && "
end end
cmd = cmd.. cmd = cmd..
'/usr/bin/convert "'.. '/usr/bin/convert "'..
event.source..p..'" "'.. event.source..p..'" "'..
event.source..base..'.'..k.. event.source..base..'.'..k..
@ -61,7 +61,7 @@ convert = {
spawnShell(event, cmd) spawnShell(event, cmd)
return return
end end
-- deletes all formats if you delete one -- deletes all formats if you delete one
if event.etype == "Delete" then if event.etype == "Delete" then
-- builds one bash command -- builds one bash command
@ -99,8 +99,8 @@ convert = {
local inlet = event.inlet local inlet = event.inlet
if event.etype == "Create" or if event.etype == "Create" or
event.etype == "Modify" or event.etype == "Modify" or
event.etype == "Delete" event.etype == "Delete"
then then
for k, _ in pairs(formats) do for k, _ in pairs(formats) do
inlet.rmExclude(base..'.'..k) inlet.rmExclude(base..'.'..k)

View File

@ -26,12 +26,12 @@ local rsyncpostcmd = {
-- triggering an error if not. -- triggering an error if not.
local isPostcmd = rawget(event, "isPostcmd") local isPostcmd = rawget(event, "isPostcmd")
if event.isPostcmd then if event.isPostcmd then
spawn(event, "/usr/bin/ssh", spawn(event, "/usr/bin/ssh",
config.host, config.postcmd) config.host, config.postcmd)
return return
else else
-- this is the startup, forwards it to default routine. -- this is the startup, forwards it to default routine.
return default.rsync.action(inlet) return default.rsync.action(inlet)
end end
error("this should never be reached") error("this should never be reached")
end end
@ -78,7 +78,7 @@ local rsyncpostcmd = {
sync { sync {
rsyncpostcmd, rsyncpostcmd,
source = "src", source = "src",
host = "beetle", host = "beetle",
targetdir = "/path/to/trg", targetdir = "/path/to/trg",

View File

@ -9,8 +9,8 @@ settings = {
} }
sync{ sync{
default.rsync, default.rsync,
source="src", source="src",
target="trg", target="trg",
} }

View File

@ -1,7 +1,7 @@
----- -----
-- An Lsyncd+IRC-Bot Config -- An Lsyncd+IRC-Bot Config
-- --
-- Logs into an IRC channel and tells there everything that happens in the -- Logs into an IRC channel and tells there everything that happens in the
-- watched directory tree. -- watched directory tree.
-- --
-- The challenge coding Lsyncd configs taking use of TCP sockets is -- The challenge coding Lsyncd configs taking use of TCP sockets is
@ -10,7 +10,7 @@
-- no longer spawning processes (this example doesnt do any, but maybe you -- no longer spawning processes (this example doesnt do any, but maybe you
-- might want to do that as well), blocking is just bad. -- might want to do that as well), blocking is just bad.
-- --
-- This demo codes just minimal IRC functionality. -- This demo codes just minimal IRC functionality.
-- it does not respond to anything else than IRC PING messages. -- it does not respond to anything else than IRC PING messages.
-- --
-- There is no flood control, if a lot happens the IRC server will disconnect -- There is no flood control, if a lot happens the IRC server will disconnect
@ -55,7 +55,7 @@ local function ircWritey(fd)
end end
---- ----
-- Called when there is data on the socket -- Called when there is data on the socket
local function ircReady(socket) local function ircReady(socket)
local l, err, ircRBuf = ircSocket:receive("*l", ircRBuf) local l, err, ircRBuf = ircSocket:receive("*l", ircRBuf)
if not l then if not l then
@ -88,7 +88,7 @@ function writeIRC(...)
log("Error", "IRC connection failed: ", err) log("Error", "IRC connection failed: ", err)
terminate(-1) terminate(-1)
end end
--- logs what has been send, without the linefeed. --- logs what has been send, without the linefeed.
if (ircWBuf:sub(s, s) == "\n") then if (ircWBuf:sub(s, s) == "\n") then
log("Normal", "ircout:", ircWBuf:sub(1, s - 1)) log("Normal", "ircout:", ircWBuf:sub(1, s - 1))
@ -133,8 +133,8 @@ local function action(inlet)
end end
-- Watch a directory, and use a second for delay to aggregate events a little. -- Watch a directory, and use a second for delay to aggregate events a little.
sync{source = "src", sync{source = "src",
action = action, action = action,
delay = 1, delay = 1,
onMove = true} onMove = true}