2
0
mirror of https://github.com/deajan/osync synced 2024-11-15 12:12:56 +00:00
osync/sync.conf.example

209 lines
10 KiB
Plaintext
Raw Normal View History

2014-05-26 22:50:46 +00:00
#!/usr/bin/env bash
2013-07-15 22:10:23 +00:00
2016-05-25 17:58:06 +00:00
###### osync - Rsync based two way sync engine with fault tolerance
###### (C) 2013-2017 by Orsiris de Jong (www.netpower.fr)
2017-06-05 16:53:15 +00:00
###### osync v1.1x / v1.2x config file rev 2017060501
2013-07-15 22:10:23 +00:00
2013-11-02 20:57:15 +00:00
## ---------- GENERAL OPTIONS
2013-07-15 22:10:23 +00:00
2013-11-02 20:57:15 +00:00
## Sync job identification
2015-11-27 13:12:44 +00:00
INSTANCE_ID="sync_test"
2013-08-18 11:15:40 +00:00
## Directories to synchronize.
## Initiator is the system osync runs on. The initiator directory must be a local path.
INITIATOR_SYNC_DIR="/home/git/osync/dir1"
## Target is the system osync synchronizes to (can be the same system as the initiator in case of local sync tasks). The target directory can be a local or remote path.
TARGET_SYNC_DIR="/home/git/osync/dir2"
#TARGET_SYNC_DIR="ssh://backupuser@yourhost.old:22//home/git/osync/dir2"
## If the target system is remote, you can specify a RSA key (please use full path). If not defined, the default ~/.ssh/id_rsa will be used. See documentation for further information.
2014-03-23 20:57:57 +00:00
SSH_RSA_PRIVATE_KEY="/home/backupuser/.ssh/id_rsa"
2013-07-15 22:10:23 +00:00
2016-10-19 10:31:20 +00:00
## Alternatively, you may specify an SSH password file (less secure). Needs sshpass utility installed.
2016-10-19 10:28:48 +00:00
SSH_PASSWORD_FILE=""
2017-02-08 12:35:53 +00:00
## When using ssh filter, you must specify a remote token matching the one setup in authorized_keys
_REMOTE_TOKEN=SomeAlphaNumericToken9
## Create sync directories if they do not exist
CREATE_DIRS=no
2013-07-21 19:40:55 +00:00
2013-11-02 20:57:15 +00:00
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
LOGFILE=""
2016-08-03 22:02:20 +00:00
## Generate an alert if initiator or target replicas have less free space than given value in KB. Set this to zero to skip disk space tests.
2013-07-22 19:14:57 +00:00
MINIMUM_SPACE=10240
2013-07-15 22:10:23 +00:00
## Bandwidth limit Kbytes / second. Leave 0 to disable limitation
BANDWIDTH=0
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
SUDO_EXEC=no
2013-11-02 20:57:15 +00:00
## Paranoia option. Don't change this unless you read the documentation.
2013-07-15 22:10:23 +00:00
RSYNC_EXECUTABLE=rsync
2015-07-02 14:58:02 +00:00
## Remote rsync executable path. Leave this empty in most cases
RSYNC_REMOTE_PATH=""
2013-07-15 22:10:23 +00:00
## Rsync exclude / include order (the option set here will be set first, eg: include will make include then exclude patterns)
RSYNC_PATTERN_FIRST=include
## List of files / directories to incldue / exclude from sync on both sides (see rsync patterns, wildcards work).
## Paths are relative to sync dirs. List elements are separated by a semicolon.
RSYNC_INCLUDE_PATTERN=""
RSYNC_EXCLUDE_PATTERN=""
#RSYNC_EXCLUDE_PATTERN="tmp;archives"
## Files that contains lists of files / directories to include / exclude from sync on both sides. Leave this empty if you don't want to use an exclusion file.
## This file has to be in the same directory as the config file
## Paths are relative to sync dirs. One element per line.
RSYNC_INCLUDE_FROM=""
RSYNC_EXCLUDE_FROM=""
#RSYNC_EXCLUDE_FROM="exclude.list"
## List elements separator char. You may set an alternative separator char for your directories lists above.
PATH_SEPARATOR_CHAR=";"
2013-11-02 20:57:15 +00:00
## ---------- REMOTE SYNC OPTIONS
## ssh compression should be used unless your remote connection is good enough (LAN)
2013-07-15 22:10:23 +00:00
SSH_COMPRESSION=yes
2013-11-02 20:57:15 +00:00
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
SSH_IGNORE_KNOWN_HOSTS=no
2013-08-24 17:51:39 +00:00
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
REMOTE_HOST_PING=no
2013-11-02 20:57:15 +00:00
2013-08-24 17:51:39 +00:00
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
2014-03-09 16:54:45 +00:00
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
2013-11-02 20:57:15 +00:00
## ---------- MISC OPTIONS
2016-12-13 08:18:47 +00:00
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz skip-compress checksum bwlimit partial partial-dir no-whole-file whole-file backup backup-dir suffix
## --exclude --exclude-from --include --include-from --list-only --stats
2018-02-20 21:44:53 +00:00
## When dealing with different filesystems for sync, or using SMB mountpoints, try adding --modify-window=2 --omit-dir-times as optional arguments.
2016-12-13 08:18:47 +00:00
RSYNC_OPTIONAL_ARGS=""
2016-08-09 11:44:43 +00:00
## Preserve basic linux permissions
PRESERVE_PERMISSIONS=yes
PRESERVE_OWNER=yes
PRESERVE_GROUP=yes
2016-08-22 08:27:36 +00:00
## On MACOS X, does not work and will be ignored
2016-08-09 12:12:07 +00:00
PRESERVE_EXECUTABILITY=yes
## Preserve ACLS. Make sure source and target FS can handle ACL. Disabled on Mac OSX.
2013-07-24 19:03:58 +00:00
PRESERVE_ACL=no
2017-05-02 22:19:18 +00:00
## Preserve Xattr. Make sure source and target FS can manage identical XATTRS. Disabled on Mac OSX. Apparently, prior to rsync v3.1.2 there are some performance caveats with transferring XATTRS.
2013-07-24 19:03:58 +00:00
PRESERVE_XATTR=no
2016-12-01 20:12:47 +00:00
## Transforms symlinks into referent files/dirs. Be careful as symlinks without referrent will break sync as if standard files could not be copied.
2014-06-13 20:09:40 +00:00
COPY_SYMLINKS=no
2014-05-27 17:58:59 +00:00
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
2014-06-13 20:09:40 +00:00
KEEP_DIRLINKS=no
2014-05-08 10:36:36 +00:00
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
2014-05-21 16:44:25 +00:00
PRESERVE_HARDLINKS=no
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
CHECKSUM=no
2013-11-02 20:57:15 +00:00
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
2013-07-15 22:10:23 +00:00
RSYNC_COMPRESS=yes
2016-01-27 10:44:16 +00:00
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
SOFT_MAX_EXEC_TIME=7200
HARD_MAX_EXEC_TIME=10600
2013-07-15 22:10:23 +00:00
2016-08-22 08:27:36 +00:00
## Log a message every KEEP_LOGGING seconds just to know the task is still alive
KEEP_LOGGING=1801
2014-05-27 12:18:48 +00:00
## Minimum time (in seconds) in file monitor /daemon mode between modification detection and sync task in order to let copy operations finish.
2014-01-19 19:31:14 +00:00
MIN_WAIT=60
## Maximum time (in seconds) waiting in file monitor / daemon mode. After this time, sync is run.
## Use 0 to wait indefinitely.
MAX_WAIT=7200
## ---------- BACKUP AND DELETION OPTIONS
2013-11-02 20:57:15 +00:00
2017-05-30 07:29:16 +00:00
## Log a list of conflictual files
LOG_CONFLICTS=yes
2017-06-05 16:53:15 +00:00
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
ALERT_CONFLICTS=no
2013-11-02 20:57:15 +00:00
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
2013-07-16 11:55:15 +00:00
CONFLICT_BACKUP=yes
2013-11-02 20:57:15 +00:00
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
2013-07-24 19:03:58 +00:00
CONFLICT_BACKUP_MULTIPLE=no
2013-11-02 20:57:15 +00:00
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
CONFLICT_BACKUP_DAYS=30
2013-11-02 20:57:15 +00:00
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
CONFLICT_PREVALANCE=initiator
2013-07-15 22:10:23 +00:00
2015-02-12 08:46:16 +00:00
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
2013-07-15 22:10:23 +00:00
SOFT_DELETE=yes
2013-11-02 20:57:15 +00:00
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
2013-07-15 22:10:23 +00:00
SOFT_DELETE_DAYS=30
2016-10-21 10:38:03 +00:00
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
SKIP_DELETION=
2013-11-02 20:57:15 +00:00
## ---------- RESUME OPTIONS
2013-07-24 19:03:58 +00:00
## Try to resume an aborted sync task
RESUME_SYNC=yes
2015-02-12 08:46:16 +00:00
## Number maximum resume tries before initiating a fresh sync.
RESUME_TRY=2
2016-07-18 08:09:46 +00:00
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
FORCE_STRANGER_LOCK_RESUME=no
2015-02-12 08:46:16 +00:00
## Keep partial uploads that can be resumed on next run, experimental feature
2014-11-26 10:25:58 +00:00
PARTIAL=no
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
DELTA_COPIES=yes
2013-11-02 20:57:15 +00:00
## ---------- ALERT OPTIONS
## List of alert mails separated by spaces
2016-11-24 17:27:16 +00:00
## Most Unix systems (including Win10 bash) have mail support out of the box
## Just make sure that the current user has enough privileges to use mail / mutt / sendmail and that the mail system is configured to allow outgoing mails
2016-11-11 23:30:42 +00:00
## on pfSense platform, smtp support needs to be configured in System > Advanced > Notifications
2013-07-24 19:03:58 +00:00
DESTINATION_MAILS="your@alert.tld"
2013-07-15 22:10:23 +00:00
2017-02-05 12:11:00 +00:00
## Optional change of mail body encoding (using iconv)
## By default, all mails are sent in UTF-8 format without header (because of maximum compatibility of all platforms)
## You may specify an optional encoding here (like "ISO-8859-1" or whatever iconv can handle)
MAIL_BODY_CHARSET=""
## Additional mail parameters needed for Android / Busybox / Cygwin / MSYS
## Android & Busybox use sendmail (and openssl if encryption is needed)
## MSYS & Cygwin Windows mail support relies on mailsend.exe from muquit, http://github.com/muquit/mailsend which needs to be in %PATH% environment variable
2014-05-25 15:51:05 +00:00
SENDER_MAIL="alert@your.system.tld"
SMTP_SERVER=smtp.your.isp.tld
2016-05-25 17:58:06 +00:00
SMTP_PORT=25
# encryption can be tls, ssl or none
SMTP_ENCRYPTION=none
SMTP_USER=
SMTP_PASSWORD=
2013-11-02 20:57:15 +00:00
## ---------- EXECUTION HOOKS
2015-11-27 13:12:44 +00:00
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
2013-07-15 22:10:23 +00:00
LOCAL_RUN_BEFORE_CMD=""
LOCAL_RUN_AFTER_CMD=""
2013-07-24 19:03:58 +00:00
REMOTE_RUN_BEFORE_CMD=""
REMOTE_RUN_AFTER_CMD=""
2013-07-15 22:10:23 +00:00
2013-11-02 20:57:15 +00:00
## Max execution time of commands before they get force killed. Leave 0 if you don't wan't this to happen. Time is specified in seconds.
2013-07-15 22:10:23 +00:00
MAX_EXEC_TIME_PER_CMD_BEFORE=0
MAX_EXEC_TIME_PER_CMD_AFTER=0
2013-09-11 14:22:49 +00:00
2016-07-18 08:09:46 +00:00
## Stops osync execution if one of the above commands fail
2013-09-11 14:22:49 +00:00
STOP_ON_CMD_ERROR=yes
## Run local and remote after sync commands even on failure
RUN_AFTER_CMD_ON_ERROR=no