【问题标题】:using supervisord to run lsyncd script使用 supervisord 运行 lsyncd 脚本
【发布时间】:2019-08-14 02:25:47
【问题描述】:

我正在尝试使用 supervisord 运行我的 lsynd 脚本,以使其始终运行。 我已经为我的主管编写了这个 conf 代码

[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

脚本在启动时运行正常,但总是退出

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)

我不明白这是否是保持 lsynd 脚本存活的正确方法。 有什么建议吗?

【问题讨论】:

    标签: supervisord lsyncd


    【解决方案1】:

    我正在使用这个配置来管理文件 /etc/supervisor/conf.d/lsyncd.conf

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

    并将此配置到 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"
        }
    }
    

    我还配置了 ssh 密钥并在服务器中安装了 rsync。

    【讨论】:

      猜你喜欢
      • 2012-06-20
      • 1970-01-01
      • 2015-05-10
      • 2015-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-05
      相关资源
      最近更新 更多