2

I'm trying to run my lsynd's script with supervisord in order to have it always run. I've coded this conf for my supervisor

[program:autostart_lsyncd]
command=bash -c "lsyncd /home/sync/lsyncd_script.lua"
autostart=true
autorestart=unexpected
numprocs=1
startsecs = 0
stderr_logfile=/var/log/autostart_sync.err.log
stdout_logfile=/var/log/autostart_sync.out.log

Script runs ok at startup but it exits always

2018-04-09 09:48:49,638 INFO success: autostart_lsyncd entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2018-04-09 09:48:49,639 INFO exited: autostart_lsyncd (exit status 0; expected)

I can't understand if this is the correct way to keep alive a lsynd script or not. Suggestions?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Claudio Pomo
  • 2,392
  • 7
  • 42
  • 71

1 Answers1

1

I'm using this configuration to supervisord in file /etc/supervisor/conf.d/lsyncd.conf

[program:lsyncd]
command=/usr/bin/lsyncd -nodaemon /etc/lsyncd/lsyncd.conf.lua
autostart=true
autorestart=unexpected
startretries=3

And this configuration to lsyncd (/etc/lsyncd/lsyncd.conf.lua):

settings {
    logfile = "/var/log/lsyncd/lsyncd.log",
    statusFile = "/var/log/lsyncd/lsyncd.status"
}

sync {
    default.rsync,
    source="/var/www/html/sites/default/files",
    target="root@cdn:/var/www/html/sites/default/files",
    exclude = {"*.php", "*.po", "\.ht*"},
    rsync = {
        archive = false,
        acls = false,
        compress = true,
        links = false,
        owner = false,
        perms = false,
        verbose = true,        
        rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
    }
}

Also I had configure ssh keys and install rsync in the servers.

vifito
  • 177
  • 4