mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-04 19:03:17 +00:00
removing extra linespaces, comment cleanup
This commit is contained in:
parent
f50be8e51b
commit
9106f81c4a
@ -1,8 +1,8 @@
|
||||
-----
|
||||
-- User configuration file for lsyncd.
|
||||
--
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
settings.nodaemon = true
|
||||
|
@ -1,7 +1,7 @@
|
||||
-----
|
||||
-- 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.
|
||||
--
|
||||
settings = {
|
||||
@ -28,16 +28,16 @@ bash = {
|
||||
-- calls `cp -r SOURCE/* TARGET` only when there is something in SOURCE
|
||||
-- otherwise it deletes contents in the target if there.
|
||||
onStartup = [[
|
||||
if [ "$(ls -A ^source)" ]; then
|
||||
cp -r ^source* ^target;
|
||||
else
|
||||
if [ "$(ls -A ^source)" ]; then
|
||||
cp -r ^source* ^target;
|
||||
else
|
||||
if [ "$(ls -A ^target)" ]; then rm -rf ^target/*; fi
|
||||
fi]],
|
||||
|
||||
onCreate = prefix..[[cp -r ^sourcePath ^targetPathdir]],
|
||||
|
||||
|
||||
onModify = prefix..[[cp -r ^sourcePath ^targetPathdir]],
|
||||
|
||||
|
||||
onDelete = prefix..[[rm -rf ^targetPath]],
|
||||
|
||||
onMove = prefix..[[mv ^o.targetPath ^d.targetPath]],
|
||||
|
@ -1,7 +1,7 @@
|
||||
-----
|
||||
-- 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.
|
||||
--
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
echo = {
|
||||
maxProcesses = 1,
|
||||
delay = 1,
|
||||
onStartup = "/bin/echo telling about ^source",
|
||||
onStartup = "/bin/echo telling about ^source",
|
||||
onAttrib = "/bin/echo attrib ^pathname",
|
||||
onCreate = "/bin/echo create ^pathname",
|
||||
onDelete = "/bin/echo delete ^pathname",
|
||||
|
@ -1,8 +1,8 @@
|
||||
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-- lftp.lua
|
||||
-- User configuration file for lsyncd.
|
||||
--
|
||||
-- Syncs with 'lftp'.
|
||||
--
|
||||
-- Syncs with lftp
|
||||
-- A (Layer 1) configuration.
|
||||
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
lftp = {
|
||||
|
@ -1,22 +1,22 @@
|
||||
-----
|
||||
-- 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
|
||||
-- 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
|
||||
-- by others. Usually this involves frequent handfixes by a sysadmin,
|
||||
-- or a cron job that recursively chmods/chowns the whole directory.
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- 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.
|
||||
|
||||
----
|
||||
@ -27,29 +27,29 @@ fgroup = "staff"
|
||||
-----
|
||||
-- script for all changes.
|
||||
--
|
||||
command =
|
||||
-- checks if the group is the one enforced and sets them if not
|
||||
command =
|
||||
-- checks if the group is the one enforced and sets them if not
|
||||
[[
|
||||
perm=`stat -c %A ^sourcePathname`
|
||||
if [ `stat -c %G ^sourcePathname` != ]]..fgroup..[[ ]; then
|
||||
/bin/chgrp ]]..fgroup..[[ ^sourcePathname || /bin/true;
|
||||
fi
|
||||
/bin/chgrp ]]..fgroup..[[ ^sourcePathname || /bin/true;
|
||||
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
|
||||
/bin/chmod g+rw ^sourcePathname || /bin/true;
|
||||
fi
|
||||
if [ `expr match $perm "....rw"` == 0 ]; then
|
||||
/bin/chmod g+rw ^sourcePathname || /bin/true;
|
||||
fi
|
||||
]] ..
|
||||
|
||||
-- and forces the executable bit for directories.
|
||||
[[
|
||||
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;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
]]
|
||||
|
||||
-- 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
|
||||
-- starts with a slash otherwisw
|
||||
--
|
||||
startup =
|
||||
--
|
||||
startup =
|
||||
[[^/bin/chgrp -R ]]..fgroup..[[ ^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 = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
----
|
||||
-- Lsyncd user-script that creates a "magic" image converter directory.
|
||||
--
|
||||
--
|
||||
-- This configuration will automatically convert all images that are placed
|
||||
-- in the directory 'magicdir' all resulting images are placed in the same
|
||||
-- directory!
|
||||
@ -50,7 +50,7 @@ convert = {
|
||||
if cmd ~= "" then
|
||||
cmd = cmd .. " && "
|
||||
end
|
||||
cmd = cmd..
|
||||
cmd = cmd..
|
||||
'/usr/bin/convert "'..
|
||||
event.source..p..'" "'..
|
||||
event.source..base..'.'..k..
|
||||
@ -61,7 +61,7 @@ convert = {
|
||||
spawnShell(event, cmd)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- deletes all formats if you delete one
|
||||
if event.etype == "Delete" then
|
||||
-- builds one bash command
|
||||
@ -99,8 +99,8 @@ convert = {
|
||||
local inlet = event.inlet
|
||||
|
||||
if event.etype == "Create" or
|
||||
event.etype == "Modify" or
|
||||
event.etype == "Delete"
|
||||
event.etype == "Modify" or
|
||||
event.etype == "Delete"
|
||||
then
|
||||
for k, _ in pairs(formats) do
|
||||
inlet.rmExclude(base..'.'..k)
|
||||
|
@ -26,12 +26,12 @@ local rsyncpostcmd = {
|
||||
-- triggering an error if not.
|
||||
local isPostcmd = rawget(event, "isPostcmd")
|
||||
if event.isPostcmd then
|
||||
spawn(event, "/usr/bin/ssh",
|
||||
spawn(event, "/usr/bin/ssh",
|
||||
config.host, config.postcmd)
|
||||
return
|
||||
else
|
||||
-- this is the startup, forwards it to default routine.
|
||||
return default.rsync.action(inlet)
|
||||
return default.rsync.action(inlet)
|
||||
end
|
||||
error("this should never be reached")
|
||||
end
|
||||
@ -78,7 +78,7 @@ local rsyncpostcmd = {
|
||||
|
||||
|
||||
sync {
|
||||
rsyncpostcmd,
|
||||
rsyncpostcmd,
|
||||
source = "src",
|
||||
host = "beetle",
|
||||
targetdir = "/path/to/trg",
|
||||
|
@ -9,8 +9,8 @@ settings = {
|
||||
}
|
||||
|
||||
sync{
|
||||
default.rsync,
|
||||
source="src",
|
||||
target="trg",
|
||||
default.rsync,
|
||||
source="src",
|
||||
target="trg",
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
-----
|
||||
-- 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.
|
||||
--
|
||||
-- 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
|
||||
-- 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.
|
||||
--
|
||||
-- There is no flood control, if a lot happens the IRC server will disconnect
|
||||
@ -55,7 +55,7 @@ local function ircWritey(fd)
|
||||
end
|
||||
|
||||
----
|
||||
-- Called when there is data on the socket
|
||||
-- Called when there is data on the socket
|
||||
local function ircReady(socket)
|
||||
local l, err, ircRBuf = ircSocket:receive("*l", ircRBuf)
|
||||
if not l then
|
||||
@ -88,7 +88,7 @@ function writeIRC(...)
|
||||
log("Error", "IRC connection failed: ", err)
|
||||
terminate(-1)
|
||||
end
|
||||
|
||||
|
||||
--- logs what has been send, without the linefeed.
|
||||
if (ircWBuf:sub(s, s) == "\n") then
|
||||
log("Normal", "ircout:", ircWBuf:sub(1, s - 1))
|
||||
@ -133,8 +133,8 @@ local function action(inlet)
|
||||
end
|
||||
|
||||
-- Watch a directory, and use a second for delay to aggregate events a little.
|
||||
sync{source = "src",
|
||||
action = action,
|
||||
sync{source = "src",
|
||||
action = action,
|
||||
delay = 1,
|
||||
onMove = true}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user