patrickpeng2091 / lsyncd

Automatically exported from code.google.com/p/lsyncd
GNU General Public License v2.0
0 stars 0 forks source link

Documentation #86

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
using the example in layer 3 in the documentation i get this error: attempt to 
concatenate field 'target' (a nil value)

Original issue reported on code.google.com by LoneWo...@gmail.com on 29 Sep 2011 at 10:35

GoogleCodeExporter commented 9 years ago
I could not reproduce this error. Please provide more info like your exact 
configuration script, the debug/error log and what `ls -al /bin/sh' yields. I 
changed the example tough so it should now be compatible with 'dash' which is 
the default shell on my system.

Original comment by axk...@gmail.com on 30 Sep 2011 at 12:23

GoogleCodeExporter commented 9 years ago
configuration file:
settings = {
        nodaemon = true,
}

bash = {
        delay = 0,
        maxProcesses = 3,
        onCreate = "echo creat ^sourcePathname ^targetPathname",
        onModify = "echo mod ^sourcePathname ^targetPathname",
        onDelete = "echo del ^targetPathname",
        onMove   = "echo move ^o.targetPathname ^d.targetPathname",
--        onStartup = [[if [ "$(ls -A ^source)" ]; then cp -r ^source* ^target; 
fi]],
}

sync{bash, source="/home/lonewolf/teste1", targetDir="/home/lonewolf/teste2"}

ls -al /bin/sh
lrwxrwxrwx 1 root root 4 Jan 25  2011 /bin/sh -> bash

a simple touch /home/lonewolf/teste1/test triggers the error

debug log:
kernels clocks_per_sec=100
Call: configure()
Inotify: inotify fd = 3
Call: initialize()
13:28:22 FWrite: translated [[echo creat ^sourcePathname ^target]] to
function(event)
    log("Normal", "Event " .. event.etype ..
        [[ spawns shell 'echo creat ]]..event.sourcePathname..[[ ]]..event.target..[[']])
    spawnShell(event, [[echo creat "$1" "$2"]],
         event.sourcePathname,
         event.target)
end
13:28:22 Function: Inotify.addWatch(/home/lonewolf/teste1/, (true), (nil), 
(nil))
13:28:22 Inotify: addwatch(/home/lonewolf/teste1/)->1
13:28:22 Call: getAlarm()
13:28:22 Alarm: runner.getAlarm returns: (true)
13:28:22 Masterloop: immediately handling delays.
13:28:22 Call: cycle()
13:28:22 Function: invokeActions('Sync1',(Timestamp: 4634745.99))
13:28:22 Call: getAlarm()
13:28:22 Alarm: runner.getAlarm returns: (false)
13:28:22 Masterloop: going into select (no timeout).
13:28:47 Call: inotifyEvent()
13:28:47 Inotify: got event Create test(1)
13:28:47 Function: delay(Sync1, Create, /test, (nil))
13:28:47 Delay: New Create:/test
13:28:47 Call: inotifyEvent()
13:28:47 Inotify: got event Attrib test(1)
13:28:47 Function: delay(Sync1, Attrib, /test, (nil))
13:28:47 Delay: Attrib:/test absorbed by Create:/test
13:28:47 Call: inotifyEvent()
13:28:47 Inotify: got event Modify test(1)
13:28:47 Function: delay(Sync1, Modify, /test, (nil))
13:28:47 Delay: Modify:/test absorbed by Create:/test
13:28:47 Call: cycle()
13:28:47 Function: invokeActions('Sync1',(Timestamp: 4634770.63))
13:28:47 Error: IN LUA: [string "return function(event)..."]:3: attempt to 
concatenate field 'target' (a nil value)
13:28:47 Error: Backtrace 1 :[string "return function(event)..."]:3
13:28:47 Error: Backtrace 2 :/usr/lib64/lsyncd/lsyncd.lua:3715
13:28:47 Error: Backtrace 3 :/usr/lib64/lsyncd/lsyncd.lua:1473
13:28:47 Error: Backtrace 4 :/usr/lib64/lsyncd/lsyncd.lua:2597

Original comment by LoneWo...@gmail.com on 30 Sep 2011 at 12:29

GoogleCodeExporter commented 9 years ago
The call should be 

sync{bash, source="/home/lonewolf/teste1", target="/home/lonewolf/teste2"}

not targetDir.

Sorry it doesn't complain more early

BTW direct operation is now built into Lsyncd already as 'default.direct'.

Original comment by axk...@gmail.com on 30 Sep 2011 at 1:01

GoogleCodeExporter commented 9 years ago
Its working now, in my opinion you should put a complete example for each 
layer, it would make it easier for who is starting to use it.

Original comment by LoneWo...@gmail.com on 30 Sep 2011 at 1:31

GoogleCodeExporter commented 9 years ago
will do.

Original comment by axk...@gmail.com on 30 Sep 2011 at 1:51

GoogleCodeExporter commented 9 years ago
Your issue has been moved to https://github.com/axkibe/lsyncd/issues

Original comment by axk...@gmail.com on 16 Nov 2011 at 3:58