lsyncd
Synchronize directories quickly to remote destinations
TLDR
Watch the source for changes and run rsync to synchronize files to the destination on every change
Use SSH instead of rsyncd shares
SYNOPSIS
lsyncd [options] configuration
PARAMETERS
-version
Displays lsyncd's version number.
-help
Displays a help message with command-line options.
-log
Specifies the log file to use. If not specified, logs to syslog.
-status
Specifies the status file to use. If not specified, status not shown in a file.
-nodaemon
Runs lsyncd in the foreground (no daemonization).
configuration
Specifies the path to the LUA configuration file. This file defines the synchronization settings and behavior.
DESCRIPTION
lsyncd (Live Synchronizing Daemon) synchronizes local directories with a remote directory, or between local directories, efficiently. It achieves this by monitoring local directory changes and then invoking rsync (or other configurable commands) to propagate these changes to the target directory.
Unlike simple rsync scripts, lsyncd uses inotify to react to file system events in real time, making it significantly faster and more efficient. It aggregates multiple events and delays the synchronization process, reducing the load on the system and network. This is particularly useful when dealing with frequently changing files or large directories. lsyncd is commonly used for mirroring web servers, backing up important data, and keeping development and production environments in sync.
CAVEATS
lsyncd relies on the inotify subsystem of the Linux kernel. It is essential to configure the inotify limits in `/etc/sysctl.conf` for large directories to avoid `IN_Q_OVERFLOW` errors, which can lead to missed file changes. Also, it's primarily designed for Linux; cross-platform support might be limited or require alternative solutions.
LUA CONFIGURATION
The core of lsyncd is its Lua configuration. This file specifies the source and target directories, the synchronization method (e.g., rsync, bsync), exclusion patterns, and other advanced options like defining your own filters or commands to run after synchronization. See the lsyncd documentation for full information regarding configuration.
HISTORY
lsyncd was created to provide a more efficient and responsive file synchronization solution than traditional cron-based rsync scripts. The use of inotify significantly improved performance by allowing lsyncd to react immediately to file system changes. It has become a popular choice for various applications requiring real-time or near real-time data synchronization. Its development has continued with improvements in configuration options and increased stability.
SEE ALSO
rsync(1), inotifywait(1)