lipengyu / lsyncd

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

tried to implement the group permission example using octal notation instead of "g+rw", lsyncd status immediately becomes: lsyncd dead but pid file exists #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Starting lsyncd service

What is the expected behavior? What does Lsyncd do instead?
I actually had this running as of yesterday, but then lsyncd began filling my 
log files with "Normal: waiting for 1 more child processes" messages and 
wrapping the CPU to 100%.  I read the post about that and upgraded today to 
2.0.6, and now lsyncd won't process the config file. 

What version of Lsyncd are you using? On what operating system (host and
target(s)?
lsyncd Version: 2.0.6
cat /etc/redhat-release: Red Hat Enterprise Linux Server release 6.2 (Santiago)

(this machine is both host and target)

Also, I'm using Lua 5.1.5 

If applicable please copy/paste your Lsyncd configuration file.

-- Test lsyncd config

-- statusInterval = writes status file in seconds

settings = {
    logfile = "/var/log/lsyncd/lsyncd.log",
    statusFile = "/var/log/lsyncd/lsyncd.stat",
    pidfile = "/var/run/lsyncd.pid",
}

-- Want to force permissions to be group writeable since ExpanDrive 
-- doesn't respect the server umask settings
-- script for group permission changes.

command = 
[[
perm=`stat -c %a ^sourcePathname`
if test `expr $perm = 2775` -eq 0; then 
    /bin/chmod 2775 ^sourcePathname || /bin/true;
fi 
]]

---
-- on startup recursively sets all group permissions
-- all group permissions are set to 'rw'
--
-- the hash in the first line is important, otherwise due to the starting
-- slash, Lsyncd would think it is a call to the binary /bin/chgrp only
-- and would optimize the shell call away.
-- 
startup = 
[[#
/bin/chmod -R 0775 ^source || /bin/true &&
/usr/bin/find ^source -type d | xargs chmod 2775
]]

---
gforce = {
        maxProcesses = 99,
        delay        = 1,
        onStartup    = startup,
        onAttrib     = command,
        onCreate     = command,
        onModify     = command,
        -- does nothing on moves, they won't change permissions
        onMove       = true,
}

---
sync{gforce, source="/export/web/www-dev.al.noaa.gov/http", rsyncOpts={"-ltrs"} 
}

If applicable please copy/paste a logfile generated with '-log all' of a
minimal testcase that raises this problem.

Thu Mar 22 12:19:31 2012 Debug: daemonizing now.
Thu Mar 22 12:19:31 2012 FWrite: translated "perm=`stat -c %a ^sourcePathname`
if test `expr $perm = 2775` -eq 0; then 
    /bin/chmod 2775 ^sourcePathname || /bin/true;
fi" to 
function(event)
    log('Normal', 'Event ',event.etype,
        ' spawns shell "perm=`stat -c %a ]]..event.sourcePathname..[[`
if test `expr $perm = 2775` -eq 0; then 
    /bin/chmod 2775 ]]..event.sourcePathname..[[ || /bin/true;
fi"')
    spawnShell(event, 'perm=`stat -c %a "$1"`
if test `expr $perm = 2775` -eq 0; then 
    /bin/chmod 2775 "$1" || /bin/true;
fi',
         event.sourcePathname)
end
Thu Mar 22 12:19:31 2012 Error: IN LUA: lsyncd.lua:2819: [string "return 
function(event)..."]:3: unfinished string near '' spawns shell "perm=`stat -c 
%a ]]..ev
ent.sourcePathname..[[`'
Thu Mar 22 12:19:31 2012 Error: Backtrace 1 :[C]:-1
Thu Mar 22 12:19:31 2012 Error: Backtrace 2 :lsyncd.lua:2819

Please provide any additional information below.
I can see that it is an error in the script, but I can't figure out what it 
is...

Original issue reported on code.google.com by queen...@smithfox.net on 22 Mar 2012 at 6:21

GoogleCodeExporter commented 9 years ago
I must have messed up the function writer when reworking some of the code. I 
just commited a patch to the git repository. Should be fixed now.

PS: The issues list on google projects should actually be closed, this is the 
new tracker:
https://github.com/axkibe/lsyncd/issues

Original comment by axk...@gmail.com on 22 Mar 2012 at 6:54

GoogleCodeExporter commented 9 years ago
Hey there.  So I hate to sound like a complete idiot, but how do I apply this 
patch?  Do I just change the two lines in the lsyncd-2.0.6/lsyncd.lua file?  
Thanks for fixing that so quickly, by the way.

--jenny

Original comment by queen...@smithfox.net on 22 Mar 2012 at 7:12

GoogleCodeExporter commented 9 years ago
Sorry.  I figured it out.  I have a terrible head cold right now, not thinking 
too clearly.  I replaced those two lines and recompiled and it looks like it's 
working.  Well, it's not dying, and it's not wrapping up my CPU.  It looks like 
it's fixing the permissions, too, so all is well.  Thanks again,

--jenny

Original comment by queen...@smithfox.net on 22 Mar 2012 at 7:20

GoogleCodeExporter commented 9 years ago
The simpelst way is you go to https://github.com/axkibe/lsyncd and click the 
ZIP button.

Or you install git and say 'git clone git@github.com:axkibe/lsyncd.git'

Note that the source is a little less pre-prepared than a release. You start by 
running './autogen.sh', then ./configure and make like normal. It might need a 
few packages more installed than a release.

But if you just change these two lines you should be set as well.

Original comment by axk...@gmail.com on 22 Mar 2012 at 7:22

GoogleCodeExporter commented 9 years ago
Get well soon!

Original comment by axk...@gmail.com on 22 Mar 2012 at 7:33