在 Ubuntu 20.04 上安装 lsyncd
创建 lsyncd.conf.lua
settings = {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status"
}
sync {
default.rsyncssh,
source = "/var/www/",
host = "1.1.1.1",
targetdir = "/var/vidsg"
}
systemctl status lsyncd 获取此信息
● lsyncd.service - LSB: lsyncd daemon init script
Loaded: loaded (/etc/init.d/lsyncd; generated)
Active: active (exited) since Sun 2021-08-15 00:04:19 CEST; 11min ago
Docs: man:systemd-sysv-generator(8)
Process: 3460 ExecStart=/etc/init.d/lsyncd start (code=exited, status=0/SUCCESS)
systemd[1]: Starting LSB: lsyncd daemon init script...
lsyncd[3460]: * Starting synchronization daemon lsyncd
lsyncd[3466]: Error: Do not use settings = { ... }
lsyncd[3466]: please use settings{ ... } (without the equal sign)
lsyncd[3460]: ...fail!
systemd[1]: Started LSB: lsyncd daemon init script.
如果我运行 journalctl ,我会看到以下内容:
Aug 14 22:36:10 vmi098767.myserver.net lsyncd[1004057]: ...fail!
Aug 14 22:36:10 vmi098767.myserver.net systemd[1]: Started LSB: lsyncd daemon init script.
Aug 14 22:37:28 vmi098767.myserver.net systemd[1]: Stopping LSB: lsyncd daemon init script...
Aug 14 22:37:28 vmi098767.myserver.net lsyncd[1004328]: * Stopping synchronization daemon lsyncd
Aug 14 22:37:28 vmi098767.myserver.net lsyncd[1004328]: ...done.
Aug 14 22:37:28 vmi098767.myserver.net systemd[1]: lsyncd.service: Succeeded.
Aug 14 22:37:28 vmi098767.myserver.net systemd[1]: Stopped LSB: lsyncd daemon init script.
Aug 14 22:37:28 vmi098767.myserver.net systemd[1]: Starting LSB: lsyncd daemon init script...
Aug 14 22:37:28 vmi098767.myserver.net lsyncd[1004345]: * Starting synchronization daemon lsyncd
Aug 14 22:37:28 vmi098767.myserver.net lsyncd[1004350]: Error: Do not use settings = { ... }
Aug 14 22:37:28 vmi098767.myserver.net lsyncd[1004350]: please use settings{ ... } (without the equal sign)
Aug 14 22:37:28 vmi098767.myserver.net lsyncd[1004345]: ...fail!
Aug 14 22:37:28 vmi098767.myserver.net systemd[1]: Started LSB: lsyncd daemon init script.
Aug 14 22:39:28 vmi098767.myserver.net systemd[1]: Stopping LSB: lsyncd daemon init script...
Aug 14 22:39:28 vmi098767.myserver.net lsyncd[1004484]: * Stopping synchronization daemon lsyncd
Aug 14 22:39:28 vmi098767.myserver.net lsyncd[1004484]: ...done.
Aug 14 22:39:28 vmi098767.myserver.net systemd[1]: lsyncd.service: Succeeded.
Aug 14 22:39:28 vmi098767.myserver.net systemd[1]: Stopped LSB: lsyncd daemon init script.
Aug 14 22:39:28 vmi098767.myserver.net systemd[1]: Starting LSB: lsyncd daemon init script...
Aug 14 22:39:28 vmi098767.myserver.net lsyncd[1004499]: * Starting synchronization daemon lsyncd
Aug 14 22:39:28 vmi098767.myserver.net lsyncd[1004505]: Error: Do not use settings = { ... }
Aug 14 22:39:28 vmi098767.myserver.net lsyncd[1004505]: please use settings{ ... } (without the equal sign)
Aug 14 22:39:28 vmi098767.myserver.net lsyncd[1004499]: ...fail!
Aug 14 22:39:28 vmi098767.myserver.net systemd[1]: Started LSB: lsyncd daemon init script.
Aug 14 22:57:10 vmi098767.myserver.net systemd[1]: Stopping LSB: lsyncd daemon init script...
Aug 14 22:57:10 vmi098767.myserver.net lsyncd[1005037]: * Stopping synchronization daemon lsyncd
Aug 14 22:57:10 vmi098767.myserver.net lsyncd[1005037]: ...done.
Aug 14 22:57:10 vmi098767.myserver.net systemd[1]: lsyncd.service: Succeeded.
Aug 14 22:57:10 vmi098767.myserver.net systemd[1]: Stopped LSB: lsyncd daemon init script.
Aug 14 22:57:10 vmi098767.myserver.net systemd[1]: Starting LSB: lsyncd daemon init script...
Aug 14 22:57:10 vmi098767.myserver.net lsyncd[1005055]: * Starting synchronization daemon lsyncd
Aug 14 22:57:10 vmi098767.myserver.net lsyncd[1005060]: Error: Do not use settings = { ... }
Aug 14 22:57:10 vmi098767.myserver.net lsyncd[1005060]: please use settings{ ... } (without the equal sign)
Aug 14 22:57:10 vmi098767.myserver.net lsyncd[1005055]: ...fail!
Aug 14 22:57:10 vmi098767.myserver.net systemd[1]: Started LSB: lsyncd daemon init script.
Aug 14 22:59:13 vmi098767.myserver.net systemd[1]: Stopping LSB: lsyncd daemon init script...
Aug 14 22:59:13 vmi098767.myserver.net lsyncd[1005114]: * Stopping synchronization daemon lsyncd
Aug 14 22:59:13 vmi098767.myserver.net lsyncd[1005114]: ...done.
Aug 14 22:59:13 vmi098767.myserver.net systemd[1]: lsyncd.service: Succeeded.
Aug 14 22:59:13 vmi098767.myserver.net systemd[1]: Stopped LSB: lsyncd daemon init script.
Aug 14 22:59:13 vmi098767.myserver.net systemd[1]: Starting LSB: lsyncd daemon init script...
Aug 14 22:59:13 vmi098767.myserver.net lsyncd[1005132]: * Starting synchronization daemon lsyncd
Aug 14 22:59:13 vmi098767.myserver.net lsyncd[1005139]: Error: Do not use settings = { ... }
Aug 14 22:59:13 vmi098767.myserver.net lsyncd[1005139]: please use settings{ ... } (without the equal sign)
Aug 14 22:59:13 vmi098767.myserver.net lsyncd[1005132]: ...fail!
Aug 14 22:59:13 vmi098767.myserver.net systemd[1]: Started LSB: lsyncd daemon init script.
Aug 14 22:59:58 vmi098767.myserver.net systemd[1]: Stopping LSB: lsyncd daemon init script...
Aug 14 22:59:58 vmi098767.myserver.net lsyncd[1005250]: * Stopping synchronization daemon lsyncd
Aug 14 22:59:58 vmi098767.myserver.net lsyncd[1005250]: ...done.
Aug 14 22:59:58 vmi098767.myserver.net systemd[1]: lsyncd.service: Succeeded.
Aug 14 22:59:58 vmi098767.myserver.net systemd[1]: Stopped LSB: lsyncd daemon init script.
-- Reboot --
Aug 14 23:00:24 vmi098767.myserver.net systemd[1]: Starting LSB: lsyncd daemon init script...
Aug 14 23:00:25 vmi098767.myserver.net lsyncd[437]: * Starting synchronization daemon lsyncd
Aug 14 23:00:25 vmi098767.myserver.net lsyncd[453]: Error: Do not use settings = { ... }
Aug 14 23:00:25 vmi098767.myserver.net lsyncd[453]: please use settings{ ... } (without the equal sign)
Aug 14 23:00:25 vmi098767.myserver.net lsyncd[437]: ...fail!
如何修复此问题。
答案1
错误本身正在显示解决方案。
lsyncd[3466]: 错误:请勿使用设置 = { ... } lsyncd[3466]: 请使用设置{ ... }(不带等号)
您的配置文件以 settings = { 开头
相反应该是,设置{