.\" Sorry for my English .\" --Dmitry Yu Okunev 0x8E30679C .\" .\" Thanks to oldlaptop [https://github.com/oldlaptop] for help with spelling .\" .TH CLSYNC 1 "JULY 2013" Linux "User Manuals" .SH NAME clsync \- live sync tool, written in GNU C .SH SYNOPSIS .B clsync [ ... ] .SH DESCRIPTION .B clsync executes .I sync\-handler with appropriate arguments on FS events in directory .I watch\-dir using the .BR inotify (7) Linux kernel subsystem. Extended regex\-rules to filter what files and directories to sync may be placed in .I rules\-file .SH OPTIONS This options can be passed as arguments or to be used in the configuration file. To disable numeric option set to zero: .RS =0 .RE To disable string option (for example path to file) set to empty string: .RS = .RE Also you can use previously set values while setting new options. Substring .IR %option_name% will be substituted with previously set value of option .IR option_name . (see .BR "CONFIGURATION FILE" ) .B \-W, \-\-watch\-dir .I watch\-dir .RS 8 Root directory to be monitored by .BR clsync . Required. .PP .RE .B \-S, \-\-sync\-handler .I sync\-handler .RS 8 Path to .I sync\-handler to be used for syncing by .BR clsync . (see .IR \-\-mode ) Required. .PP .RE .B \-R, \-\-rules\-file .I rules\-file .RS 8 Path to file with filter rules of objects to be monitored. (see .BR RULES ) Is not set by default. .PP .RE .B \-D, \-\-destination\-dir .I destination\-directory .RS 8 Defines directory to sync to for modes "rsyncdirect", "rsyncso" and "so". (see .IR \-\-mode ) Is not set by default. .PP .RE .B \-M, \-\-mode .I mode .RS 8 Sets syncing mode. Possible values: .RS .IR simple .RS calls .IR sync\-handler " for every event" .RE .IR shell .RS calls .IR sync\-handler " for every sync" .RE .IR rsyncdirect .RS calls rsync by path .IR sync\-handler " directly (inflexible and unreliable, should be used only as a proof of concept)" .RE .IR rsyncshell .RS calls .IR sync\-handler " that supposed to run rsync for every sync (recommended mode)" .RE .IR rsyncso .RS loads shared object by path .IR sync\-handler " with " .BR dlopen "(3) and calls function " clsyncapi_rsync " function for every sync" .RE .IR so .RS loads shared object by path .IR sync\-handler " with " .BR dlopen "(3) and calls function " clsyncapi_sync " function for every sync" .RE .RE See .B SYNC HANDLER MODES .PP Required. .RE .B \-b, \-\-background .RS 8 Daemonize, forcing clsync to fork() on start. Is not set by default. .PP .RE .B \-H, \-\-config\-file .I config\-file\-path .RS 8 Use configuration from file .IR config\-file\-path (see .BR "CONFIGURATION FILE" ). Set to "/NULL/" if no config files should be read. Is not set by default. .PP .RE .B \-K, \-\-config\-block .I config\-block\-name .RS 8 Use configuration block with name .IR config\-block\-name (see .BR "CONFIGURATION FILE" ). Default value is "default". .PP .RE .B \-\-config\-block\-inherits .I config\-parent\-block\-name .RS 8 Use configuration block with name .IR config\-parent\-block\-name as parent for .IR config\-block\-name (see .BR "CONFIGURATION FILE" ). Options from .IR config\-parent\-block\-name will be inherited to .IR config\-block\-name . Default value is "default". .PP .RE .B \-z, \-\-pid\-file .I path\-to\-pidfile .RS 8 Writes pid to file by path .IR path\-to\-pidfile . Is not set by default. .PP .RE .B \-\-status\-file .I status\-file\-path .RS 8 Write status description into file with path .IR status\-file\-path . Possible statuses: .RS 8 .IR starting .RS initializing subsystems and marking file tree with FS monitor subsystem .RE .IR initsync .RS processing initial syncing .RE .IR running .RS waiting for events or syncing .RE .IR rehashing .RS reloading configuration files .RE .IR "thread gc" .RS running threads' garbage collector .RE .IR terminating .RS received signal to die, preparing to die .RE .IR exiting .RS cleaning up [for .BR valgrind (1)] .RE .RE Is not set by default. .PP .RE .B \-u, \-\-uid .I uid .RS 8 Drop user privileges to uid .I uid with .BR setuid (2) Is not set by default. .PP .RE .B \-g, \-\-gid .I gid .RS 8 Drop group privileges to gid .I gid with .BR setgid (2) Is not set by default. .PP .RE .B \-r, \-\-retries .I "number-of-tries" .RS 8 Tries limit to sync with .IR sync-handler . .B clsync will die after .I number-of-tries tries. To try infinite set "0". Delay between tries is equal to .I \-\-delay\-sync value. Default value is "1". .RE .B \-\-ignore\-failures .RS 8 Don't die on sync failures. Is not set by default. .RE .B \-p, \-\-threading .I threading-mode .RS 8 Use .BR pthreads (7) to parallelize syncing processes. For example if .B clsync (with .BR \-\-threading=off ) is already syncing a huge file then all other syncs will be suspended until the huge file syncing finish. To prevent this suspends you can use "safe" or "full" threading mode. Possbile values: .RS .IR off .RS disable threading for syncing processes. .RE .IR safe .RS parallelize syncs but suspend syncings of object that are already syncing in another process (until the process finish). .RE .IR full .RS parallelize syncs without suspendings. .RE .RE Characteristics: .RS .IR off .RS New modifications won't be synced until old ones finish. .RE .IR safe .RS Theoretically is the best way. But may utilize of lot of CPU if there's a lot of simultaneous parallel syncs. (also this way is not well tested) .RE .IR full .RS May cause multiple simultaneous syncing of the same file, which in turn can cause bug inside .IR sync\-handler " (see below)." .RE .RE If you're running .B clsync with option .B \-\-threading=full in conjunction with .B rsync with option .BR \-\-backup , you may catch a bug due to nonatomicity of rsync's file replace operation. (see .BR DIAGNOSTICS ) Default value is "off". .RE .B \-Y, \-\-output .I log\-destination .RS 8 Sets destination for log writing (errors, warnings, infos and debugging). Possible values: .RS .I stderr .br .I stdout .br .I syslog .RE Default value is "stderr". .RE .B \-\-one\-file\-system .RS 8 Don't follow to different devices' mount points. This option just adds option "FTS_XDEV" for .BR fts_open (3) function. .B Warning! If you're using this option (but no \-\-exclude\-mount\-points) .B clsync will write neither includes nor excludes of content of mount points. .br This may cause problems e.g. you're using rsync for sync-handler without similar option "\-\-one\-file\-system". Is not set by default. .RE .B \-X, \-\-exclude\-mount\-points .RS 8 Forces .I \-\-one\-file\-system but also add excludes to do not sync mount points. This requires to do .BR stat (2) syscalls on every dir and can reduce performance. Is not set by default. .RE .PP .B \-c, \-\-cluster\-iface .I interface\-ip .RS 8 .B Not implemented, yet. .B DANGEROUS OPTION. This functionality wasn't tested well. You can lost your data. Enables inter-node notifing subsystem to prevent sync looping between nodes. This's very useful features that provides ability of birectional sync of the same directory between two or more nodes. .I interface-ip is an IP-address already assigned to the interface that will be used for multicast notifing. Not enabled by default. To find out the IP-address on interface "eth0", you can use for example next command: ip a s eth0 | awk '{if($1=="inet") {gsub("/.*", "", $2); print $2}}' Is not set by default. .RE .PP .B \-m, \-\-cluster\-ip .I multicast\-ip .RS 8 .B Not implemented yet. Sets IP-address for multicast group. This option can be used only in conjunction with .BR \-\-cluster\-interface . Use IP-addresses from 224.0.0.0/4 for this option. Default value is "227.108.115.121". [(128+"c")."l"."s"."y"] .RE .PP .B \-P, \-\-cluster\-port .I multicast\-port .RS 8 .B Not implemented yet. Sets UDP-port number for multicast messages. This option can be used only in conjunction with .BR \-\-cluster\-interface . .I multicast\-port should be greater than 0 and less than 65535. Default value is "40079". [("n" << 8) + "c"] .RE .PP .B \-W, \-\-cluster\-timeout .I cluster\-timeout .RS 8 .B Not implemented yet. Sets timeout (in milliseconds) of waiting answer from another nodes of the cluster. If there's no answer from some node, it will be excluded. Default value is "1000". [1 second] .RE .PP .B \-n, \-\-cluster\-node\-name .I cluster\-node\-name .RS 8 .B Not implemented yet. Sets the name of current node in the cluster. It will be used in action scripts of another nodes (see .BR "SYNC HANDLER MODES" ). Default value is $(uname \-n). .RE .PP .B \-o, \-\-cluster\-hash\-dl\-min .I hash\-dirlevel\-min .RS 8 Sets minimal directory level for ctime hashing (see .BR CLUSTERING ). Default value is "1". .RE .PP .B \-O, \-\-cluster\-hash\-dl\-max .I hash\-dirlevel\-max .RS 8 .B Not implemented yet. Sets maximal directory level for ctime hashing (see .BR CLUSTERING ). Default value is "16". .RE .PP .B \-\-cluster\-scan\-dl\-max .I scan\-dirlevel\-max .RS 8 .B Not implemented yet. Sets maximal directory level for ctime scanning (see .BR CLUSTERING ). Default value is "32". .RE .PP .B \-\-standby\-file .I standby\-file\-path .RS 8 Sets file to path that should be checked before every sync. If file exists the sync will be suspended until the file is deleted. It may be useful if you need freeze destination directory while running some scripts. Is not set by default. .RE .PP .B \-\-max\-iterations .I iterations\-count .RS 8 Sets synchronization iterations limit. One iteration means one sync-handler execution. .I iterations\-count .RS 8 set to 0 means no limit (infinite loop). set to 1 means that only initial sync will be done set to n means that only initial sync and (n-1) sync-ups after that will be done .RE Hint: This option may be useful in conjunction with \-\-exit\-on\-no\-events to prevent infinite sync-up processes. Default value is "0". .RE .PP .B \-k, \-\-timeout\-sync .I sync-timeout .RS 8 Sets timeout for syncing processes. .B clsync will die if syncing process alive more than .I sync-timeout seconds. Set "0" to disable the timeout. Default value is "86400" ["24 hours"]. .RE .PP .B \-w, \-\-delay\-sync .I additional\-delay .RS 8 Sets the minimal delay (in seconds) between syncs. Default value is "30". .RE .PP .B \-t, \-\-delay\-collect .I ordinary\-delay .RS 8 Sets the delay (in seconds) to collect events about ordinary files and directories. Default value is "30". .RE .PP .B \-T, \-\-delay\-collect\-bigfile .I bigfiles\-delay .RS 8 Sets the delay (in seconds) to collect events about "big files" (see .IR \-\-threshold\-bigfile ). Default value is "1800". .RE .PP .B \-B, \-\-threshold\-bigfile .I filesize\-threshold .RS 8 Sets file size threshold (in bytes) that separates ordinary files from "big files". Events about "big files" are processed in another queue with a separate collecting delay. This is supposed to be used as a means of unloading IO resources. Default value is "134217728" ["128 MiB"]. .RE .PP .B \-L, \-\-lists\-dir .I tmpdir\-path .RS 8 Sets directory path to output temporary events\-lists files. If this option is enabled, .B clsync will execute .I sync\-handler once for each aggregated event list, passing the path to a file containing this list (actions "synclist" and "rsynclist"). Otherwise, .B clsync will execute .I sync\-handler for every file in the aggregated event list (action "sync"). Cannot be used in mode "so". See .BR "SYNC HANDLER MODES" . Is not set by default. .RE .PP .B \-\-have\-recursive\-sync .RS 8 Use action "recursivesync" instead of "synclist" for directories that were just marked (see .B "SYNC HANDLER MODES" case .BR shell ). Is not set by default. .RE .PP .B \-\-synclist\-simplify .RS 8 Removes the first 3 parameters in list files of action "synclist" (see .B "SYNC HANDLER MODES" case .BR shell ). Is not set by default. .RE .PP .B \-A, \-\-auto\-add\-rules\-w .RS 8 Forces clsync to create a "w\-rule" for every non-"w-rule" (see .BR RULES ). Not recommended to use in modes "rsyncdirect", "rsyncshell" and "rsyncso" Is not set by default. .RE .PP .B \-\-rsync\-inclimit .I rsync\-includes\-line\-limit .RS 8 Sets soft limit for lines count in files by path .IR rsync\-listpath . Unfortunately, rsync works very slowly with huge "\-\-include\-from" files. So, .B clsync splits that list with approximately .I rsync\-includes\-line\-limit lines per list if it's too big, and executes by one rsync instance per list part. Use value "0" to disable the limit. Default value is "20000". .RE .PP .B \-\-rsync\-prefer\-include .RS 8 Forces .B clsync to prefer a "lot of includes" method instead of a "excludes+includes" for rsync on recursive syncing. See cases .BR rsyncshell , .B rsyncdirect and .B rsyncso of .BR "SYNC HANDLER MODES" . This option is not recommended. Is not set by default. .RE .PP .B \-x, \-\-ignore\-exitcode .I exitcode .RS 8 Forces .B clsync to do not process exitcode .I exitcode of .I sync\-handler as an error. You can set multiple ignores by passing this option multiple times. Recommended values for rsync case is "24". You can set multiple values with listing a lot of "\-x" options (e.g. "\-x 23 \-x 24") or via commas (e.g. "\-x 23,24"). To drop the list use zero exitcode (e.g. "\-x 0"). For example you can use "\-x 0,23" to drop the list and set "23"-th exitcode to be ignored. Is not set by default (or equally is set to "0"). .RE .PP .B \-U, \-\-dont\-unlink\-lists .RS 8 Do not delete list\-files after .I sync\-handler has finished. This may be used for debugging purposes. Is not set by default. .RE .PP .B \-F, \-\-full\-initialsync .RS 8 Ignore filter rules from .I rules-file on initial sync. This may be useful for quick start or e.g. if it's required to sync "/var/log/" tree but not sync every change from there. Is not set by default. .RE .PP .B \-\-only\-initialsync .RS 8 Exit after initial syncing on clsync start. Is not set by default. .RE .PP .B \-\-exit\-on\-no\-events .RS 8 Exit if there's no events. Works like .IR \-\-only\-initialsync , but also syncs events collected while the initial syncing. Unlike .I \-\-only\-initialsync this option uses FS monitor subsystem to monitor for new events while the initial syncing. This may reduce performance. On the other hand this way may be used to be sure, that everything is synced at the moment before clsync will exit. Is not set by default. .RE .PP .B \-\-skip\-initialsync .RS 8 Skip initial syncing on clsync start. Is not set by default. .RE .PP .B \-\-exit\-hook .I path\-of\-exit\-hook\-program .RS 8 Sets path of program to be executed on clsync exit. If this parameter is set, clsync will exec on exit: .RS .I path\-of\-exit\-hook\-program label .RE The execution will be skipped if syncing process wasn't started. Is not set by default. .RE .PP .B \-v, \-\-verbose .RS 8 This option is supposed to increase verbosity. But at the moment there's no "verbose output" in the code, so the option does nothing. :) Is not set by default. .RE .PP .B \-d, \-\-debug .RS 8 Increases debugging output. This may be supplied multiple times for more debugging information, up to a maximum of five "d" flags (more will do nothing), for example "\-d \-d \-d \-d \-d" or "\-d5" (equivalent cases) Is not set by default. .RE .PP .B \-\-dump\-dir .RS 8 Directory to write clsync's instance information by signal 29 (see .BR SIGNALS ")." The directory shouldn't exists before dumping. Is set to "/tmp/clsync-dump-%label%" by default. .RE .PP .B \-q, \-\-quiet .RS 8 Suppresses error messages. Is not set by default. .RE .PP .B \-f, \-\-fanotify .RS 8 .B Don't use this option! Switches monitor subsystem to "fanotify" [it's described for future\-compatibility]. Is not set by default. .RE .PP .B \-i, \-\-inotify .RS 8 Switches monitor subsystem to "inotify". Is set by default. .RE .PP .B \-l, \-\-label .I label .RS 8 Sets a label for this instance of clsync. The .I label will be passed to .I sync\-handler every execution. Default value is "nolabel". .RE .PP .B \-h, \-\-help .RS 8 Outputs options list and exits with exitcode "0". Is not set by default. .RE .PP .B \-V, \-\-version .RS 8 Outputs clsync version and exits with exitcode "0". Is not set by default. .RE .SH SYNC HANDLER MODES .B clsync executes .I sync\-handler that supposed to take care of the actual syncing process. Therefore .B clsync is only a convenient way to run a syncing script. .B clsync can run .I sync\-handler in six ways. Which way will be used depends on specified mode (see .IR \-\-mode ) case .B simple .RS Executes for every syncing file/dir: .br .I sync\-handler sync .I label evmask path [nodes] In this case, .I sync\-handler is supposed to non\-recursively sync file or directory by .IR path . With .I evmask it's passed bitmask of events with the file or directory (see "/usr/include/linux/inotify.h"). Not recommended. Not well tested. .RE case .B shell .RS Executes for every sync (if .B recursivesync is not used instead): .br .I sync\-handler synclist .I label listpath [nodes] Executes for initial syncs if option .I \-\-have\-recursive\-sync is set: .br .I sync\-handler recursivesync .I label dirpath [nodes] In this case, .I sync\-handler is supposed to non\-recursively sync files and directories from list in a file by path .I listpath (see below). With .I evmask it's passed bitmask of events with the file or directory (see "/usr/include/linux/inotify.h"). Also .I sync\-handler is supposed to recursively sync data from directory by path .I dirpath with manual excluding extra files. Not recommended. Not well tested. .RE case .B rsyncdirect .RS Executes for every sync: .br .I sync\-handler \-\-inplace \-aH \-\-delete\-before [\-\-exclude\-from .I rsync\-exclude\-listpath ] \-\-include\-from .I rsync\-listpath \-\-exclude '*' .I watch-dir/ dest-dir/ In this case, .I sync\-handler is supposed to be a path to .B rsync binary. Error code "24" from .I sync\-handler will be ignored in this case. This case is supposed to be used only as a proof of concept. .RE case .B rsyncshell .RS Executes for every sync: .br .I sync\-handler rsynclist .I label rsync\-listpath [nodes] [rsync\-exclude\-listpath] In this case, .I sync\-handler is supposed to run "rsync" application with parameters: \-aH \-\-delete\-before \-\-include\-from .I rsync\-listpath \-\-exclude '*' if option .I \-\-rsync\-prefer\-include is enabled. And with parameters: \-aH \-\-delete\-before \-\-exclude\-from .I rsync\-exclude\-listpath \-\-include\-from .I rsync\-listpath \-\-exclude '*' if option .I \-\-rsync\-prefer\-include is disabled. Recommended case. .RE case .B rsyncso .RS In this case there's no direct exec*() calling. In this case .B clsync loads .I sync-handler as a shared library with .BR dlopen (3) and calls function "int clsyncapi_rsync(const char *inclist, const char *exclist)" from it for every sync. .br .B inclist is a path to file with rules for "\-\-include\-from" option of rsync. This argument is always not NULL. .br .B exclist is a path to file with rules for "\-\-exclude\-from" option of rsync. This argument is NULL if .B \-\-rsync\-prefer\-include is set. .br .I "Excludes takes precedence over includes." Also may be defined functions "int clsyncapi_init(options_t *, indexes_t *)" and "int clsyncapi_deinit()" to initialize and deinitialize the syncing process by this shared object. To fork the process should be used function "pid_t clsyncapi_fork(options_t *)" instead of "pid_t fork()" to make clsync be able to kill the child. See example file "clsync-synchandler-rsyncso.c". Recommended case. IMHO, this way is the best. .RE case .B so .RS In this case there's no direct exec*() calling. In this case .B clsync loads .I sync-handler as a shared library with .BR dlopen (3) and calls function "int clsyncapi_sync(int n, api_eventinfo_t *ei)" from it for every sync. .B n is number of elements of .BR ei . .B ei is an array of structures with information about what and how to sync (see below). api_eventinfo_t is a structure: .RS struct api_eventinfo { .br uint32_t evmask; // event bitmask for file/dir by path .BR path . .br uint32_t flags; // flags of "how to sync" the file/dir .br size_t path_len; // strlen(path) .br const char *path; // the .B path to file/dir need to be synced .br eventobjtype_t objtype_old; // type of object by path .B path before the event. .br eventobjtype_t objtype_new; // type of object by path .B path after the event. .br }; .br typedef struct api_eventinfo api_eventinfo_t; .RE The event bitmask (evmask) values can be learned from "/usr/include/linux/inotify.h". There may be next flags' values (flags): .RS enum eventinfo_flags { .br EVIF_NONE = 0x00000000, // No modifier .br EVIF_RECURSIVELY = 0x00000001 // sync the file/dir recursively .br }; .RE .br Flag "EVIF_RECURSIVELY" may be used if option .I \-\-have\-recursive\-sync is set. Is that a file or directory by path .B path can be determined with .B objtype_old and .BR objtype_new . .br .B objtype_old reports about which type was the object by the path before the event. .br .B objtype_new reports about which type became the object by the path after the event. .B objtype_old and .BR objtype_new have type .BR eventobjtype_t . .RS enum eventobjtype { .br EOT_UNKNOWN = 0, // Unknown .br EOT_DOESNTEXIST = 1, // Doesn't exist (not created yet or already deleted) .br EOT_FILE = 2, // File .br EOT_DIR = 3, // Directory .br } typedef enum eventobjtype eventobjtype_t; .RE Also may be defined functions "int clsyncapi_init(options_t *, indexes_t *)" and "int clsyncapi_deinit()" to initialize and deinitialize the syncing process by this shared object. To fork the process should be used function "pid_t clsyncapi_fork(options_t *)" instead of "pid_t fork()" to make clsync be able to kill the child. See example file "clsync-synchandler-so.c". Recommended case. .RE About the .I label see .IR \-\-label . .br .I nodes is comma-separated list of cluster nodes names where to sync to (see .IR \-\-cluster-node-name ) The listfile by path .I listpath contains lines separated by NL (without CR) of next format: .RS sync .I label evmask path .RS if option .I \-\-synclist\-simplify is not set .RE .I path .RS if option .I \-\-synclist\-simplify is set .RE Every lines is supposed to be proceed by external syncer to sync file or directory by path .IR path . With .I evmask it's passed bitmask of events with the file or directory (see "/usr/include/linux/inotify.h"). .RE .SH ENVIRONMENT VARIABLES Output variables - variables that are set by clsync before calling .IR sync-handler . .B "Output variables" .RS CLSYNC_STATUS - .BR clsync 's status (see possible statuses in description of .IR \-\-status\-file ) .RE .RS CLSYNC_ITERATION - count of done synchronizaton iterations after initial sync see \-\-max\-iterations option .RE .SH RULES Filter riles can be placed into .I rules\-file with one rule per line. Rule format: .I [+\-][fdw*]regexp .I + \- means include; .I \- \- means exclude; .I f \- means file; .I d \- means directory; .I w \- means walking to directory; .I * \- means all. For example: \-*^/[Tt]est It's not recommended to use .I w rules in modes "rsyncdirect", "rsyncshell" and "rsyncso". .BR rsync (1) allows one to set syncing and walking only together in "\-\-include" rules ("\-\-files\-from" is not appropriate due to problem with syncing files deletions). So there may be problems with clsync's .I w rules in this cases. More examples: Syncing pwdb files and sshd_config (non-rsync case): .RS +f^/passwd$ .br +f^/group$ .br +f^/shadow$ .br +f^/ssh/sshd_config$ .br +w^$ .br +w^/ssh$ .br \-* .RE Syncing pwdb files and sshd_config (non-rsync case with option .IR \-\-auto\-add\-rules\-w ): .RS +f^/passwd$ .br +f^/group$ .br +f^/shadow$ .br +f^/ssh/sshd_config$ .br -* .RE Syncing pwdb files and sshd_config (rsync case): .RS +f^/passwd$ .br +f^/group$ .br +f^/shadow$ .br +f^/ssh/sshd_config$ .br +d^$ .br +d^/ssh$ .br -* .RE Syncing /srv/lxc tree (rsync case): .RS \-d/sess(ion)?s?$ .br \-f/tmp/ .br +* .RE .SH SIGNALS 1 \- to reread filter rules 10 \- runs threads' GC function 12 \- runs full resync 16 \- interrupts sleep()/select() and wait() [for debugging and internal uses] 29 \- dump information to .IR dump-dir [for debugging] .SH DIAGNOSTICS Initial rsync process works very slow on clsync start .RS Probably there's too huge exclude list is passed to rsync. This can happened if you're excluding with regex in clsync's rules a lot of thousands files. They will be passed to rsync's exclude list one by one. To diagnose it, you can use "\-U" option and look into .I rsync\-exclude\-listpath file (see .B "SYNC HANDLER" case .BR d ) To prevent this, it's recommended to write such rules for rsync directly (not via clsync). For example, often problem is with PHP's session files. You shouldn't exclude them in clsync's rules with "\-f/sess_.*", but you should exclude it in rsync directly (e.g with «\-\-exclude "sess_*"»). .RE The following diagnostics may be issued on stderr: Error: Cannot inotify_add_watch() on [...]: No space left on device (errno: 28) .RS Not enough inotify watching descriptors is allowed. It can be fixed by increasing value of "sysctl fs.inotify.max_user_watches" .RE Error: Got non-zero exitcode .I exitcode [...] .RS .I sync\-handler returned non-zero exitcode. Probably, you should process exitcodes in it or your syncer process didn't worked well. I case of using rsync, you can find the exitcodes meanings in .BR "man 1 rsync" . If .I exitcode equals to 23 and you're using .B clsync in conjunction with .BR rsync , this may happend, for example in next cases: .RS \- Not enough space on destination. \- You're running clsync with .B \-\-threading and rsync with .BR \-\-backup . See bugreport by URL: .IR https://bugzilla.samba.org/show_bug.cgi?id=10081 . .RE To confirm the problem, you can try to add "return 0" or "exit 0" into your .IR sync\-handler . .RE To get support see .BR SUPPORT . .SH CONFIGURATION FILE .B clsync supports configuration file. By default .B clsync tries to read next files (in specified order): .RS ~/.clsync.conf .br /etc/clsync/clsync.conf .RE This may be overrided with option .IR \-\-config\-file . .B clsync reads only one configuration file. In other words, if option .I \-\-config\-file is not set and file .B ~/.clsync.conf is accessible and parsable, .B clsync will not try to open .BR /etc/clsync/clsync.conf . Command line options have precedence over config file options. Configuration file is parsed with glib's g_key_file_* API. That means, that config should consits from groups (blocks) of key-value lines as in the example: .RS [default] .br background = 1 .br mode = rsyncshell .br debug = 0 .br output = syslog .br label = default .br pid\-file = /var/run/clsync\-%label%.pid [debug] .br config\-block\-inherits = default .br debug = 5 .br background = 0 .br output = stderr [test] .br mode=rsyncdirect .br debug=3 .RE Also glib's .B gkf API doesn't support multiple assignments. If you need to list some values (e.g. exitcodes) just list them with commas in single assignment (e.g. "ignore\-exitcode=23,24"). In this example there're 3 blocks are set - "default", "debug" and "test". And block "debug" inherited setup of block "default" except options "debug", "background" and "output". By default .B clsync uses block with name "default". Block name can be set by option .IR \-\-config\-block . .SH CLUSTERING Not implemented yet. .B Don't try to use cluster functionality. Not described yet. .SH EXAMPLES Working examples you can try out in "/usr/share/doc/clsync/examples/" directory. Copy this directory somewhere (e.g. into "/tmp"). And try to run "clsync-start-rsync.sh" in there. Any files/directories modifications in "testdir/from" will be synced to "testdir/to" with few seconds delay. .RE .SH AUTHOR Dmitry Yu Okunev 0x8E30679C .SH SUPPORT You can get support on official IRC-channel in Freenode "#clsync" or on github's issue tracking system of repository "https://github.com/xaionaro/clsync". Don't be afraid to ask about clsync configuration, ;). .SH "SEE ALSO" .BR rsync (1), .BR pthreads (7), .BR inotify (7)